Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
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
show 2 more comments
up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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