Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

How to rename a security group?

$
0
0

In .NET version 4.5 or lower, how does one go about renaming an existing security group on the local windows machine?

Is there something like NTAccount.Rename that I'm apparently missing?

Here is some sample code to get the group name and prove it resolves.

Imports System.Security.Principal

Module Module1

  Sub Main()

    Dim nta As New NTAccount(Nothing, "Sample_Groupname")
    Console.WriteLine("NTAccount name=" & nta.ToString)

    Dim arSecurityIdentifier As SecurityIdentifier = DirectCast(nta.Translate(GetType(SecurityIdentifier)), SecurityIdentifier)
    Console.WriteLine("SID=" & arSecurityIdentifier.Value)

    Console.ReadLine()

  End Sub

End Module


May we all make money in the sequel.


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>