TechInc
asked on
psexec from a batch file to execute another batch file
I am trying to use psexec to from within a batch file to run an iisreset on another machine. the batch file is local and needs to run c:\program files\psexec.exe -u username -p password \\remotemachine c:\iisreset.bat
where do i need to have psexec stored for this to work? what do i need to do for this to work. essentially, i want to do an issreset of a remote box from an end user machine where the end user is not (and CANNOT) be an administrator on the box hosting iis. I want them to be able to click the .bat on their machine that will pass credentials to the .bat on the remote machine
where do i need to have psexec stored for this to work? what do i need to do for this to work. essentially, i want to do an issreset of a remote box from an end user machine where the end user is not (and CANNOT) be an administrator on the box hosting iis. I want them to be able to click the .bat on their machine that will pass credentials to the .bat on the remote machine
ASKER
Hello. Can i add parameters to "c:\program files\psexec.exe" so that i am running the iisreset on the remote box with administrator credentials? I need end users to be able to launch this from their desktop and they will be logged into the system with an account that is NOT an administrator on the remote machine.
Yes, you can supply administrator credentials with above statement same like as you have mentioned in your question.
ASKER
c:\Program Files\psexec.exe -u admin_account -p admin_password \\cmstest c:cmsreset.bat
I can run this script from the cmd line on my local machine and it works fine. However, as soon as i paste it into a batch file it appears to run but does nothing on the remote box? What are the -i -c flags used for? Do i need to add them even though it works fine from cmdline without them?
I can run this script from the cmd line on my local machine and it works fine. However, as soon as i paste it into a batch file it appears to run but does nothing on the remote box? What are the -i -c flags used for? Do i need to add them even though it works fine from cmdline without them?
You need to enclose c:\Program Files\psexec.exe in double quotes (" ") like:
"c:\Program Files\psexec.exe" -u admin_account -p admin_password \\cmstest c:cmsreset.bat
"c:\Program Files\psexec.exe" -u admin_account -p admin_password \\cmstest c:cmsreset.bat
ASKER
bringing this question back to life.
I have to have this configured so that the end users cannot see the username or password. Additionally, i don't want them to be able to edit the batch file. So, they will have a shortcut to a batch file on their desktop that is used to run the batch file on there desktop. The batch file will then need to do a remote iisreset on a server. Keep in mind that i don't want them to be able to see anything inside the batch file. Is that even possible? Make sense?
I have to have this configured so that the end users cannot see the username or password. Additionally, i don't want them to be able to edit the batch file. So, they will have a shortcut to a batch file on their desktop that is used to run the batch file on there desktop. The batch file will then need to do a remote iisreset on a server. Keep in mind that i don't want them to be able to see anything inside the batch file. Is that even possible? Make sense?
Hey.
Can you give us an example of your issreset.bat file?
thanks
Can you give us an example of your issreset.bat file?
thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Open in new window