I have seen several posts about adding a user to local admin, but not many about removing a domain user from the local administrators group. What I am planning on doing is running this as a login script from group policy so it will run locally when the user logs in. I have this so far, but I am getting issues when it is looking for the path of the user...
Can anyone help?
strComputer = "." Set objShell = Wscript.CreateObject("Wscript.Shell") UserName = objShell.ExpandEnvironmentStrings("%USERNAME%") Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group") Set objUser = GetObject("WinNT://" & strComputer & "/DOMAIN\"" & UserName &"",user") 'WScript.Echo "/DOMAIN\" & UserName objGroup.Remove(objUser.ADsPath) msgbox "User has now been removed from local admin group" Wscript.Quit