Microsoft

System Center Configuration Manager Feedback

Suggestion box powered by UserVoice

How can we improve Configuration Manager?

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.

76 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    cscrgb shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    12 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Mike commented  ·   ·  Flag as inappropriate

        "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.

      • Mike commented  ·   ·  Flag as inappropriate

        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  ·   ·  Flag as inappropriate

        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.

      • Wayne Christopher commented  ·   ·  Flag as inappropriate

        Encapsulate the value for the -Command parameter in "&('')" to avoid syntax processing errors.

        i.e. -Command "&('some commands here')"

      • Johan Pol commented  ·   ·  Flag as inappropriate

        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.

      • cscrgb commented  ·   ·  Flag as inappropriate

        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.

      • cscrgb commented  ·   ·  Flag as inappropriate

        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.

      • cscrgb commented  ·   ·  Flag as inappropriate

        FYI - That first line should be, "Right now, if I need to run a PS script with alternate credentials in a Task Sequence requires....".

      Feedback and Knowledge Base