Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I execute a powershell script by means of group policy on a number of machines?

The script is signed and will run on the targeted machines when you right-click and select "run with powershell".

share|improve this question
Do you want to run the script as a computer startup script? Or do you want to run the script on-demand? – jscott Mar 21 '12 at 17:12
startup script please – resolver101 Mar 22 '12 at 10:34

Check out this page:

In particular, I think you'd want to edit your machine start up GPO to run:

C:\windows\system32\windowspowerShell\v1.0\powershell.exe & "C:\script.ps1"

The path to PowerShell.exe does not change if you have v1 or v2 installed.

share|improve this answer
Thanks for your reply :-) The script still does NOT start from group policy but will start if pasted into the run box when the machine is booted: "C:\windows\system32\windowspowerShell\v1.0\powershell.exe -noexit & '\\servername.local\SysVol\servername.local\Policies\{D6A8EB7C-38B0-44B8-AE81-AB6‌​B3E7D8DB0}\User\Scripts\Logon\UpdateDesktopWithBGInfo.ps1'" Any ideas on what could be the problem? – resolver101 Mar 23 '12 at 10:41
Is this a computer start up or user log on script? If the former, you'd need to make sure the machine account has access to the network location. I'm not sure what would cause the latter to not work. Maybe replace the PowerShell bit with a simple .bat file or something like that so that you know the script is able to run. That way you'll know if your problem is with calling the script, or getting to the script in the first place. – northben Mar 26 '12 at 16:16
Another option would be to use another GPO to push the script to the local computer and execute it from there. – northben Mar 26 '12 at 16:17
how have you determined that it does not run at all, as opposed to running and failing before it can have any effect? – RobM Mar 26 '12 at 16:49
Something like this would do the trick: echo "test" > "%userprofile%\desktop\test.txt" that's a .BAT file on the scripts tab, not on the PowerShell tab. – northben Mar 26 '12 at 21:16

An alternative solution (what I did) to bginfo:

  1. Set up a user logon GPO (User Configuration - Policies - Windows Settings - Scripts)
  2. Under the Scripts tab (not PowerShell), click show files, and copy bginfo.exe and your .bgi configuration file
  3. Go back to the Scripts tab, click add, enter "bginfo.exe" for Script Name, and "desktopSettings.bgi /timer:0 /nolicprompt" for Script Parameters.

Make sure you do gpupdate /force and logoff/logon, then you should see bginfo on your desktop.

share|improve this answer
I want to get powershell working because i have other uses for powershell. I thought this would be a simple script to start with. Thanks – resolver101 Mar 27 '12 at 10:30

Your Answer


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.