Hi,
Manually you can add user from Control Panel ->User Accounts -> Users ->Add. Is there any other way to add domain users to the local administrators group in a batch file? Can anyone help?
All suggestions are welcome.
Hi,
Manually you can add user from Control Panel ->User Accounts -> Users ->Add. Is there any other way to add domain users to the local administrators group in a batch file? Can anyone help?
All suggestions are welcome.
Using group policy and computer configuration, add a start up script to windows setting and scripts.
Use a batch file and add the below command.
This will add a security group from your domain to the local admins group for the desktop.net localgroup administrators "domain\security groups" /add
You can write a VBscript that will remove a user from the local administrator group on all the PC in your domain. Then you set the script up to be a startup script in group policy and it will remove the user from every computers local admin group when the computer boots up. We also use this script to change the local administrator account's name and password. If the systems are Windows 2000 there are some AD dll's that have to be registered. If they are Windows XP, it will work with out any dll registration. For e.g.
This will also remove the local everyone group from the local administrators group. If the account is local then leave off the domain name and slash in the array.Dim strLocalAdminGroup
Dim strComputer
Dim remadmins
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set WshSysEnv = WshShell.Environment("SYSTEM")
Set WshUserEnv = WshShell.Environment("User")
Set WshProEnv = WshShell.Environment("Process")
strComputer = WshProEnv("COMPUTERNAME")
remadmins = array("DomainName\UserID","Everyone")
strLocalAdminGroup = "Administrators"
You can use NET command to Add a user account:
NET USER username {password | *} /ADD [options] [/DOMAIN]
Bookmarks