0

The following command to create AppPools in IIS executes fine locally; "%windir%\system32\inetsrv\appcmd" add apppool /in < "webservice.apppools.2012.xml"

When I try to run it remotely using PsExec it gives me an 'Invalid XML input' error. From what I can tell the command is coming back to the server I am executing PSEXEC on and getting the xml file from there. This always gives the invalid xml error. Additionally, I tried copying the xml to the remote server but again, the command comes back to the executing server to get the xml file. How can I force it to execute on the remote server and use the xml there? I have tried using -i and -s.

%1 = Destination server
%3 = password
set appCmd=\\%1\c$\Windows\system32\inetsrv\appcmd
set tempFolder=D:\deployment\temp

PsExec \\%1 -u administrator -p %3 -h %appCmd% add apppool /in < "%tempFolder%\webservice.apppools.2012.xml"

There is nothing wrong with the xml as it works fine locally.

apparch
  • 1
  • 2
  • Does the xml file exist on the target system? Not sure how PSEXEC handles redirected files. Looking at some threads that use redirected input with psexec, I am pretty sure the program and file have to exist on the target system. – Squashman Feb 17 '17 at 22:08
  • I tried copying the xml file to the target system. If I give a unc path to the file I get the same error. If I give an absolute path PSEXEC looks for it on the machine I am running it on instead of the machine I am deploying on. set tempFolder=\\%1\d$\deployment\temp -UNC set tempFolder=D:\deployment\temp -absolute PsExec \\%1 -u administrator -p %3 -h "%windir%\system32\inetsrv\appcmd" add apppool /in < "%tempFolder%\webservice.apppools.2012.xml" – apparch Feb 20 '17 at 14:47
  • I have no idea what you are trying to do with that code. You should update your question with the code. It is hard to read the code in comments. I have no idea what you are trying to do with `-UNC`. I do not see any code that is copying the file to the D: drive on the target system. – Squashman Feb 20 '17 at 15:05
  • Updated my question – apparch Feb 20 '17 at 16:31

0 Answers0