DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Convert VB6 code to C#

By: Admin | 29 Aug 2008 11:23 am

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
Thanks,

Comments

using System.Security. Principal. WindowsIdentity. GetCurrentName
By: DOTNET Guru | 04 Sep 2008
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

Regards
By: DOTNET Guru | 04 Sep 2008

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move