Jump to content

Recommended Posts

Posted
So I'm trying to get a .exe cmd command to run as the local admin user on numerous computers. I've looked into the RunAs command but can't see how you set the computer name to vary per computer. Help! :)
Posted

Using the %computername% variable should work

 

runas /user:%computername%\administrator mycommand.exe

 

Although after some testing not defining any domain seems to make it default to the local machine, so this worked for me as well.

 

runas /user:administrator mycommand.exe

  • Thanks 1
Posted
Using the %computername% variable should work

 

runas /user:%computername%\administrator mycommand.exe

 

Although after some testing not defining any domain seems to make it default to the local machine, so this worked for me as well.

 

runas /user:administrator mycommand.exe

i suspect .\administrator would also work (typing in .\ is a quick way of finding a pc name from the logon screen without actually logging in)

  • Thanks 1
Posted
Using the %computername% variable should work

 

runas /user:%computername%\administrator mycommand.exe

 

Cheers Rob, this works, however cmd then asks for the administrator password. Is there anyway I can put that into the command? Ideally I'm looking for this to run automatically / silently.

 

Thanks.

Posted
i suspect .\administrator would also work (typing in .\ is a quick way of finding a pc name from the logon screen without actually logging in)

 

.\ didn't work for me under the runas, although I may have been doing something wrong.

Posted
When and why are you trying to run this? Can it be part of a startup script?

 

I'm looking at alternatives to getting Office 2016 installed. Trying to run the .exe silently as the local admin. Our currently process uses PDQ Deploy but takes 15 mins!

Posted
I'm looking at alternatives to getting Office 2016 installed. Trying to run the .exe silently as the local admin. Our currently process uses PDQ Deploy but takes 15 mins!

 

How were you planning to trigger the install?

 

If you want a more controllable solution then I'd go for PSExec scripts. This has the advantage of you being able to remotely deploy the installer to multiple machines at once.

 

If you just want to get it out there hands free the I'd put the silent install command in the shutdown script (odds are the computer taking a while to shut down isn't going to inconvenience people) and give it a couple of days. Take the command back out once all the computers are installed.

 

If you wanted to be really clever then you could (I'm assuming, I don't know how PDQ works) use PDQ to drop the install files and a scheduled task onto each machine, the scheduled task would then be set to run with admin credentials at a predefined time that's convenient for everyone. And hopefully running the install from files already on the drive will help bring down the install time.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...