3

I need to run a command to uninstall forefront on some of our workstations and am having a bit of trouble formatting the command.

Here's what needs to happen (in multiple commands)

xcopy \\serverpath\Installer.exe C:\Windows Install.exe /u /s Del C:\Windows\Install.exe

I'm using psexec with a computer list but keep running into errors. This is what my command looks like as of right now.

psexec @ComputerList.txt -u domain\administrator cmd /c (xcopy "\\NetworkPath\Forefront Software\Install.exe" "C:\Windows" && Install.exe /u /s && del C:\Windows\Install.exe)

I think the spaces in the path name and quotes are messing things up...

EDIT:

Tried running it with a script with no luck. It looks like scepinstall.exe just hangs on the remote machine. I also tried using the exe that can be found in C:\Windows\ccmsetup\

Thanks for the help

seffland
  • 31
  • 1
  • 1
  • 5
  • Create a script pass the `-c` option so the script is copied to the remote system. – Zoredache Jun 17 '14 at 18:25
  • That would force us to run multiple commands, first copying the script to all the machines then running it. We are trying to do this in one seamless command since it will be deployed to 500+ machines. If that's the only way to do it I guess we have to then... – seffland Jun 17 '14 at 18:29
  • False, read the docs. Passing the `-c` option causes psexec to copy the script as part of the task. http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx – Zoredache Jun 17 '14 at 18:30
  • Tried doing it as a script, but it's now hanging on the uninstall. I also tried a script that would CD into Windows\CCMSetup\ and run the exe there, but it returns `script.bat exited on testmachine with error code -2147156221` – seffland Jun 18 '14 at 13:30

2 Answers2

6

I don't think those parentheses are valid. I think the /s switch in cmd.exe should preserve everything between the first and last ". Does this work?

psexec @ComputerList.txt -u domain\administrator cmd /s /c "xcopy "\\NetworkPath\Forefront Software\Install.exe" "C:\Windows" && Install.exe /u /s && del C:\Windows\Install.exe"

I tested with the following simplified command and it worked (modified to /k so I could view output).

psexec \\remotemachine cmd /s /k "dir "c:\temp" && echo "hello""
pk.
  • 6,413
  • 1
  • 41
  • 63
  • It looks like this would be better suited doing multiple commands in a script, as it simplifies the process and psexec has arguments specifically for scripts. Thanks for the help! – seffland Jun 18 '14 at 13:32
0

Got it. The installer didn't like the path being hard coded in the script,

Changed from

C:\ccmsetup\scepinstall.exe /u /s

%windir%\ccmsetup\scepinstall.exe /u /s
seffland
  • 31
  • 1
  • 1
  • 5