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
parimal patelPosted Jan 13, 2009, 2:51 PM
http://www.tangiblesoftwaresolutions.com/
Muhammad Shahid FarooqPosted Aug 10, 2008, 9:06 PM
Don't say Hi next time, because this is not our tradition.
strComputer = "atl-ws-01";
objGroup = getObject("WinNT://" + strComputer + "//Administrators");
foreach(User objUser in objGroup.Members)
{
if (objUser.Name != "Administrator" && objUser.Name != "Domain Admins")
{
objGroup.Remove(objUser.AdsPath)
}
}
I think this may help you.