readmedottxt 1 Posted February 14, 2011 I have a workgroup computer. I need to remove a user from the Administrators group. This always fails, can anyone point me in the right direction? $varUser = InputBox("user to remove from admins group", "", "") $objGroup = ObjGet("WinNT://./Administrators") $objLocalMember = ObjGet("WinNT://./" & $varUser) $objGroup.Remove($objLocalMember.ADsPath) Share this post Link to post Share on other sites
Juvigy 49 Posted February 14, 2011 WMI is a little bit tricky.Try this instead. $path="net localgroup Administrators Username /Remove" RunWait(@ComSpec & ' /c ' & $path) Share this post Link to post Share on other sites
UEZ 1,272 Posted February 14, 2011 Try this: ;coded by UEZ 2011 $srv = "." $LocalGroup_Name = "Administrators" $user = "Test" $objGroup = ObjGet("WinNT://" & $srv & "/" & $LocalGroup_Name & ",group") If IsObj($objGroup) then For $objUser In $objGroup.Members If $objUser.Name = $user Then $objGroup.Remove($objUser.ADsPath) ExitLoop EndIf Next EndIf Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites