It is needed to add users to Administrators group of Servers and Desktops. To do so, we can either access the remote computer and open Administrators group and add the users. This is time consuming and needs lot of effort. The other option is to run this script to add users to Administrators group. Save the script to file add2admins.vbs, update domain name and pass the username and computername as parameter.
Usage:
>cscript add2admins.vbs username computername
'-------- Script Start -----------
DomainName = "domainname"
UserAccount = wscript.arguments(0)
sComputer = wscript.arguments(1)
set Group = GetObject("WinNT://" + sComputer + "/Administrators,group")
group.Add "WinNT://"& DomainName &"/"& UserAccount &""
wscript.echo "Done! " & now
'--------Script End-------------
Usage:
>cscript add2admins.vbs username computername
'-------- Script Start -----------
DomainName = "domainname"
UserAccount = wscript.arguments(0)
sComputer = wscript.arguments(1)
set Group = GetObject("WinNT://" + sComputer + "/Administrators,group")
group.Add "WinNT://"& DomainName &"/"& UserAccount &""
wscript.echo "Done! " & now
'--------Script End-------------
No comments:
Post a Comment