Script to add Domain Admins into local administrators group
Hello,
Script to add Domain Admins into local administrators group.
Any help with a script that can achieve this?
Thanks
Hello,
Script to add Domain Admins into local administrators group.
Any help with a script that can achieve this?
Thanks
Below you’ll find the Vbscript that can be used. It adds “YOUR DOMAIN Domain Admins” to the local Administrators group. The GPO needs to be created in the source domain.
Using this it will be much easier to migrate a user’s PC, without having to add it on each workstation by hand (one condition, each workstation needs reboot to process this computer based GPO).
Script:
*****************
Dim WSHShell, WshSysEnv
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
On Error Resume Next
UserString = WshSysEnv("COMPUTERNAME")
GroupString = "Administrators"
Set GroupObj = GetObject("WinNT://" & UserString & "/" & GroupString)
GroupObj.Add ("WinNT://YOUR DOMAIN/Domain Admins")
Set GroupObj = Nothing
Set WshShell = Nothing
Set WshSysEnv = Nothing
Wscript.Quit
*****************
The script assumes that the local administrators group is “Administrators”! If an OS language other than English is used (as we saw in Germany), the script need to be changed to the right group name for that particular language!