VB6 to C# conversion

Aug 7 2008 9:50 AM

Hi,

I want to convert following VB6 code to C#, can some one help me regarding that.

strComputer = "atl-ws-01"

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")

For Each objUser In objGroup.Members
    If objUser.Name <> "Administrator" AND objUser.Name <> "Domain Admins" Then
        objGroup.Remove(objUser.AdsPath)
    End If
Next

actually it is removing users from Local administrator group.

or if some one knows how to delete users from local administrator group in C#.

Thanks,

Mushq

 


Answers (2)