Run PowerShell Script item in Task Sequences should allow alternate credentials
Right now, if I need to run a PS script in a Task Sequence requires to use the Run Command Line item using PowerShell.exe. However, if I want to run a script with parameters, then I must use the -command option for PowerShell.exe, which has some odd parsing problems that can cause scripts to fail when run this way.
Our 1901 Tech Preview release has the changes to allow alternate credentials
This is implemented in 1902 release
"Run Command Line" has the this option using the "Run this step as the following account" check box.
"Run PowerShell Script" should also get this check box option.
The Task Sequence step "Run PowerShell Script" should allow for the use of alternate credentials like the step "Run Command Line" step allows.
We would make use of this to access network resources like Active Directory during the imaging process.
Mark Chinery commented
Aditional task sequence step to device to AD Group(s)
aditional task Sequence step to move device to an OU
Add Run As Account Option to Powershell Command TS Step.
Jörgen Nilsson commented
Wayne Christopher commented
Encapsulate the value for the -Command parameter in "&('')" to avoid syntax processing errors.
i.e. -Command "&('some commands here')"
Patrik Holmqvist commented
Johan Pol commented
Currently within SCCM 2012 running a PowerShell command script with provided credentials does not work when,
- windows 10 OSD is used
- TS is used during OSD
Therefore it would be noce that a supported powershell option is directly possible from within the TS and also has the possibility to provide domain credentials.
The new TS Action called "Run Powershell" does not allow Alternate Credentials. That is what this request is for. At least not as of SCCM 2012 R2 SP1.
Thanks. The problem isn't using parameters, it's running the PowerShell script with alternate credentials other than the default account that the TS is running under. This is good if we want to be able to access a share that the default account may not have perms to, or running WMI on the site server, etc.
Right now, the only way to do that is via the "Run Command Line" TS item with powershell.exe, but debugging the -command parameter of Powershell.exe can be difficult.
In ConfigMgr 2012 R2 , we have a new TS action called Run Powershell . That should support parameters too. Is there something we can add to that action that is missing currently. That would be good info to have as we look further into this. Thanks for the feedback.
FYI - That first line should be, "Right now, if I need to run a PS script with alternate credentials in a Task Sequence requires....".