How do I add a local admin account via script?

1050 pts.
Tags:
Group Policy Objects
Local Administrators Account
Local Administrators Group
Microsoft Windows 7
Microsoft Windows Server 2003
Microsoft Windows XP
Visual Basic
We have just recently joined to our parent companies domain, and as such our old local admin account "administrator" name is not being used as an login anymore. Most of our machines have administrator as the local admin account. Since we want to get away from that name, we would like to add a local (machine) admin account via a script. Plus Windows 7 doesn't allow for that name to be used, another reason to get away from it. I found lots of ways to add an account that is part of the admin group on the domain to the local list. The issue is we want to use a username that is allready in the administrator group on our domain. The problem is we cant change that name or password. The password is 24 characters long and meant to run all the services that were running under the old "administrator" account. Since its so long, its not the best one to use for local admin access in safe mode. Plus it wasn't added to the machines when they were setup. Does anyone have a script that will add the user "user" with a password of "password" to the local computers account. So that it will show up in the users list as USER  "name" DOMAIN "pcname" GROUP "administrator"

Software/Hardware used:
server 2003,windows 7 windows xp

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try the LG utility from JoeWare.net. Of course test this before deploying in production environment.

LG Usage
lg /?

LG V01.03.00cpp Joe Richards (joe@joeware.net) April 2010

Usage:
LG Group SecPrin [switches]

Group LocalGroup to work with
Group can be specified in the following ways:
o domain\localgroup
o \\server\localgroup
o localgroup

If Group is specified as domain\. or \\server\.
localgroups at that location are enumerated
If Group is specified as . the localgroups on
the local machine are enumerated

SecPrin Security Principal to add/remove from group

Switches: (designated by – or /)
-add Add SecPrin to Group.
-remove Remove SecPrin from Group
-cleargroup Remove all members from group
-addgroup Add localgroup specified
-removegroup Remove localgroup specified
-sid Security principal(s) are specified as SIDs
-sidsout Output SIDs instead of SecPrin member names
-r computer Specify computer to resolve SIDs. [LOCALHOST]
-comment Display LG Comments
-setcomment Set Comment for addgroup
-lu List Users (only used for . enumerate option)

Ex1:
lg domain\.
Enumerate localgroups on domain

Ex2:
lg domain\. -lu
Enumerate all localgroups and members on domain

Ex3:
lg \\computer\.
Enumerate localgroups on computer

Ex4:
lg . -comment
Enumerate localgroups and comments on localhost

Ex5:
lg users
Enumerates members of localgroup users on localhost

Ex6:
lg \\computer\bob -addgroup -setcomment “bobs group”
Create bob localgroup on computer with comment

Ex7:
lg bob -setcomment “bobs group”
Sets comment for localgroup bob on localhost

Ex8:
lg users joe doug louise /add
Adds joe, doug, and louise to localgroup users

Ex9:
lg \\comp1\users louise -add -r comp3
Adds SID resolved at comp3 for louise to localgroup users on comp1

Ex10:
lg \\comp1\users S-1-5-567-678-89765-456 -sid -add
Adds specified SID to localgroup users on comp1

Ex11:
lg \\comp1\users -sidsout
Lists members of localgroup users on comp1 in SID format

Ex12:
lg \\comp1 -lu -sidsout
Lists members of all localgroups on comp1 in SID format

This software is Freeware. Use it as you wish at your own risk.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following