I've got a script that works. See here.

Now my problem is getting it to run via a domain GPO. On my test clients, I've set the ExecutionPolicy to unrestricted.

I've tried setting it as a startup script. (preferable)

I've tried setting it as a login script.

Nothing is getting executed. If I run it as an admin user manually, it works. No dice via GPO.

Edit: I just tried a test on my XP client that has the Window Management Framework Core (KB 968930) installed. I associated .ps1 with the powershell program; it was previously associated with Notepad. I also set a local gpo that pointed to the script. I rebooted the computer, and it got to the running scripts portion of startup. It hung there for about 5 minutes before getting to the login screen. When I logged in, the program was still installed. No errors in the eventvwr that I can see.

When I was trying to push this out from my domain controller, I went to the Computer Configuration\Window Settings\Scripts and under the Powershell Scripts tab added the file with no parameters. I have yet to try the domain GPO with the file association added on the client.

What am I missing?

2008r2 and 2003 SP2 DC, Win7 and XP clients


Are you setting it to run directly by putting the script path as the "executable"? Or are you setting the executable to powershell.exe and passing the script path with the -File argument (and potentially other arguments like -NonInteractive)?

I haven't actually tested this myself, but I'm pretty sure you should be doing the latter rather than the former.

  • I'm actually just going into the Computer Configuration\Windows Settings\Startup section on my domain controller. There's a tab for powershell scripts and I just load it up there with no arguments. – Holocryptic Apr 8 '11 at 17:17
  • I'll edit my question. I just performed another test as well. – Holocryptic Apr 8 '11 at 17:18
  • Hah, I didn't even know that tab existed. You've taught me something new today and I thank you. It appears it was added with Win7/2008R2. – Ryan Bolger Apr 8 '11 at 17:49
  • In any case, you might try testing the old-style Scripts tab just to see if it works. Set the Script Name to the path to powershell.exe. Then set the Script Parameters to "-File <path to script>". – Ryan Bolger Apr 8 '11 at 17:51
  • You're welcome. And I think (read: Hope) we may be on to something here. Will update shortly. – Holocryptic Apr 8 '11 at 18:20

This looks like a no-go for XP clients. I managed to get my Win7 clients to work after setting .ps1 to associate with PS instead of Notepad.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.