I have a "Run PowerShell Script" Step in an OSD Task Sequence.
This script copies some files to a location and then runs an executable.
If I use ROBOCOPY to copy the files, i get an exit code 1 (files copied ok) and the executable fired, does what it needs to and quits happily.
If I use XCOPY (external call) or Copy-Item (PS Cmdlet) - the files still copy and land in the correct place, exit with code 0, but the executable doesn't fire up and doesn't do what it is meant to.
Any ideas?
Example code (Not working:)
if (!(Test-Path "C:\Installs\sx1install")){New-Item -ItemType Directory -Path "C:\Installs\sx1install" -Force}
Copy-Item . C:\Installs\sx1install -Recurse -Force
.\setup.exe /s /f1"c:\installs\sx1install\setup.iss"
Working:
robocopy .\ C:\Installs\sx1install /E /R:0 /W:0
.\setup.exe /s /f1"c:\installs\sx1install\setup.iss"
In both cases, C:\Installs\sx1install folder creates, gets fully populated with all required files and folders (including subfolders etc) - but the setup.exe doesn't work on the first example.
What is it about robocopy that makes this work/not work?
The non-working script works perfectly once in windows by doing a set-location to the location of the script package and then executing.
We need to try and find a way to get this to execute and return 0 as a return code 1 bombs out the task sequence. We need to stop the TS if the executable returns 1 as this is a critical part of our builds, so just setting success codes to 1 or continue or error are not a choice.
SCCM 2012 R2 CU3 // MDT 2012 // Deploying 8.1 Pro via MDT OSD TS