I have a batch file where I want to run some commands, but not all of them as administrator. I do not want to run the command prompt as administrator or run the entire batch job as administrator. An example of a command that I want to run as administrator is:
appcmd.exe recycle apppool \apppool.name -DefaultApp
Appcmd is the command for managing IIS 7, and this example I want to recycle an App Pool.
I have tried:
runas /profile /user:MYPC\administrator "appcmd.exe recycle apppool \apppool.name -DefaultApp"
I get a 1326: Logon failure: unknown user or bad password
, but I know the user and password exist. Any suggestions as to how I can do this?