Script to open cmd as a domain administrator

is this posible?
I need a simple script, to open up a command prompt as a domain administrator. Preferably without being prompted for the password. The password should be coded in to the script.

Who is Participating?
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.

JohnBusiness Consultant (Owner)Commented:
It will need to prompt for credentials, otherwise your server is hopelessly insecure
NVITEnd-user supportCommented:
You can use the RUNAS with the /savecred option.

While logged on as domain admin, create a new shortcut to CMD. Put in the following command:
runas /user:hostname\Administrator /savecred “C:\Windows\System32\cmd.exe”

The first time you double-click your shortcut, you’ll be prompted to enter the domain admin's password.

See example here:

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
JohnBusiness Consultant (Owner)Commented:
I would be concerned that anyone who might find the script would be in like flint. I like better security than this, but then you may have a different view.
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

NVITEnd-user supportCommented:
Correction to my prior post:
While logged on as domain admin, create a new shortcut to CMD
...should be:
While logged on as the user, create a new shortcut to CMD

The password is not saved in the shortcut itself. It is saved in the user's vault accessed via Credential Manager.
The asker should be aware of this.
Shaun VermaakTechnical SpecialistCommented:
runas /netonly /user:Domain\Administrator /password:* cmd.exe

Open in new window

Do not use savecred because credential can be used to start other processes elevated
Vikas BhatExperienced IT Infrastructure Services/operations ManagerCommented:
Please check my article

I have also provided a script that can be of help.
JohnBusiness Consultant (Owner)Commented:
Proper answers and advice provided
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
Windows Server 2003

From novice to tech pro — start learning today.