Script to create local admin user

I need a script that determines what domain user is correctly logged in, then creates a local admin for that user.  The users are non-admin in the domain, but they need to be a local domain so that I can make some system tweaks under their profile that require admin privileges.  I then need a script that deletes the local admin user for that domain user as I will need to remove the local account after the tweaks have been completed.
murrycAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris HInfrastructure ManagerCommented:
What OS?
0
Chris HInfrastructure ManagerCommented:
I hate VB when a batch file will do it.

Batch file 1
set /p pass=Type a Password
net user /add %username% %pass%
net localgroup administrators %username% /add

Batch file 2
net user /delete %username%
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
murrycAuthor Commented:
Windows 7 Pro

I am all for batch files or VB scripts.  Whatever works.

I don't think this batch will add the current logged in user as a local admin though.  There is no need to give it a password as the user is domain existing and so we are just adding them as a local user.  This will be executed on a domain environment.
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Chris HInfrastructure ManagerCommented:
It worked fine, see attached file....
Untitled.png
0
Chris HInfrastructure ManagerCommented:
AND ALWAYS PASSWORD PROTECT ADMIN ACCOUNTS.

Sorry, that was my old tech instructor yelling at both of us.
0
Chris HInfrastructure ManagerCommented:
Whoops, wrong pic, this one...
Untitled.png
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.