Run As Administrator Batch File Failure

0

I have a batch script that can ONLY be run properly if I right click and select Run As Administrator.  When I push this batch script out it fails.  

So then I made a shortcut to the batch script, and made that permanently run as administrator through the advanced shortcut settings.  This works by double clicking the shortcut on my local machine but when I push out via PDQDeploy it fails with a Not a valid Win32 application.  So apparently I can't push out .lnk shortcut files.  

I can put a /runas Administrator in the batch file but that prompts for a password and the password can't be embedded or piped (not that I would want to do that anyway).

Does anyone have any other ideas on how to do this and simulate the right click Run As Administrator and get it to work with PDQDeploy?  it is already being sent out with domain admin privileges. Thanks in advance.

Cancel
login to comment
0

This time when I ran it, I got an error 2 returned (last night when I pushed it out to a different computer it ran until the timeout kicked in, that is why I posted this).  I added %errorlevel% to my batch file and ran it manually on the computer and got a error code 2.  I found the issue in my batch file and redeployed and it went fine.   Thanks for the guidance.

Cancel
login to comment

0

The run as Administrator is unnecessary when deploying because the deployments are already executed in an elevated state. What error are you seeing when you attempt to deploy the batch file itself? You are correct, using a shortcut (LNK) file as the Deploy File will not work. We need to know if the batch file is failing to execute or if the error is coming from the contents of the batch.

Cancel
login to comment

Reply