Hello fellow CM community!
We are currently working on slowly migrating our SCCM 2007 environment to SCCM 2012. I am now faced with an odd issue that I did not formerly have in SCCM 2007.
Context:
- Task Sequence #1, deploys Windows 2008
- Task Sequence #2, deploys XenApp 6.5 and a bunch of applications required by our company
Issue: Setting my Powershell execution policy via Run Command Line in SCCM 2012 yields the following error message:
CreateProcess failed. Code(0x80070002)
Command line execution failed (80070002)
Failed to execute command line 'X:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -command "Set-ExecutionPolicy RemoteSigned"' .
he system cannot find the file specified. (Error: 80070002; Source: Windows)
Install Software failed to run command line, hr=0x80070002
Now, here's where I lose it.
In SCCM 2007, with my Windows 2008 TS, I have:
Run Command Line
cmd.exe /c powershell -command Set-ExecutionPolicy RemoteSigned
Run Command Line
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{Import-Module ServerManager;Add-WindowsFeature RSAT-ADCS}
Then, still in SCCM 2007, but in my XenApp 6.5 TS, I have another step that install Application-Server role with
Run Command Line
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{Import-Module ServerManager;Add-WindowsFeature Application-Server}"
All that works FINE.
An EXACT, copy paste in SCCM 2012 doesn't work as it fails on the Application Server portion of my second TS.
My first thought was Execution Policy.
What happens when I add
Run Command Line
cmd.exe /c powershell -command Set-ExecutionPolicy RemoteSigned
Right before the Application Server step? Same issue. I have tried many versions. With cmd.exe /c, without it, with quotes, with the full path, etc. It seems like as soon as I run the same command line to set the execution policy a second time, it fails.
But if I don't put the execution policy, the Application-Server role fails to install because of the Powershell restrictions.
What am I missing???? Any clues?