none
Run a powershell script with domain credentials during task sequence RRS feed

  • Question

  • I have a powershell script that adds the computer it is run on to a security group.  If I log onto the computer with a domain account it works perfectly.  However, if it is run while logged on as the local admin account it fails with an error message that says the domain either doesn't exist or cannot be reached.

    This is a problem because when a computer is being imaged the process runs with the local admin account.  Is there a way to run this script with domain credentials in the task sequence?

    Thanks,

    Andy

    Thursday, March 26, 2015 1:41 PM

Answers

All replies

  • How are you running the Powershell script? If you use a Run Command Line step, you can specify an account to run as. Something like "powershell %scriptroot%\psscript.ps1" where the psscript.ps1 is located in your Scripts folder in your deployment share.

    -Nick O.

    Thursday, March 26, 2015 2:46 PM
  • I'm using the Run Powershell Script option but I could easily change it to Run Command Line.  
    Thursday, March 26, 2015 3:18 PM
  • I'd try the Run Command Line method, which will allow you to run as a different account. I had to implement something similar to this to allow clients to connect via DirectAccess.

    -Nick O.

    Thursday, March 26, 2015 3:26 PM
  • Thanks, what's the switch to do that? 
    Thursday, March 26, 2015 3:30 PM
  • Never mind!  I figured it out.
    Thursday, March 26, 2015 3:31 PM