Results 1 to 4 of 4

Thread: How to add local domain user via batch file

  1. #1
    Join Date
    Jan 2009
    Posts
    44

    How to add local domain user via batch file

    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.

  2. #2
    Join Date
    Apr 2008
    Posts
    3,424

    Re: How to add local domain user via batch file

    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.
    net localgroup administrators "domain\security groups" /add
    This will add a security group from your domain to the local admins group for the desktop.

  3. #3
    Join Date
    May 2008
    Posts
    3,516

    Re: How to add local domain user via batch file

    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.
    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"
    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.

  4. #4
    Join Date
    Apr 2008
    Posts
    3,339

    Re: How to add local domain user via batch file

    You can use NET command to Add a user account:
    NET USER username {password | *} /ADD [options] [/DOMAIN]

Similar Threads

  1. Replies: 3
    Last Post: 05-09-2011, 10:05 PM
  2. Moving a local user to a domain user
    By alsolaih in forum Networking & Security
    Replies: 1
    Last Post: 03-02-2010, 04:58 AM
  3. Domain user to local administrators group
    By alimk in forum Windows Server Help
    Replies: 5
    Last Post: 30-09-2009, 06:33 PM
  4. Replies: 3
    Last Post: 12-03-2009, 12:56 PM
  5. Replies: 5
    Last Post: 13-06-2007, 07:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,523,980.13842 seconds with 17 queries