Script to open cmd as a domain administrator

Hello,
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.

Thanks,
Bat.
batoli1234Asked:
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.

JohnBusiness Consultant (Owner)Commented:
It will need to prompt for credentials, otherwise your server is hopelessly insecure
0
NVITCommented:
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: https://www.howtogeek.com/124087/how-to-create-a-shortcut-that-lets-a-standard-user-run-an-application-as-administrator/
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
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.
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

NVITCommented:
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.
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
Use
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
0
Vikas BhatExperienced IT Infrastructure Services/operations ManagerCommented:
Please check my article https://techofmeblogs.wordpress.com/2017/03/07/vb-scripts-and-uac-elevation/

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

From novice to tech pro — start learning today.