issues with a GPO that calls a powershell script

Hi Experts

I have a client who is enabling a new GPO that essentially calls a PowerShell script. We have tested manually the script, and it works very well.

It seems like the group policy is not working, however when you run the gpresult /r and gpupdate/force the policy is being applied. This result was verified from a WIndows 7 joined domain pc

The script basically renames old printers and printer name and add new printers with new server name for all users. I did download the script from link below

Like I mentioned earlier, the script works like a champion.
Please see  details of GPO on the attached files
Jerry SeinfieldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jerry SeinfieldAuthor Commented:
I did try using the format below with no luck

As additional note, our domain/forest functional level is Windows 2003.

Domain controllers OS. Windows 2003 R2
Print servers OS:  Windows 2008 R2

Can anyone please help me to find the root cause on why I cannot apply a GPO that looks pretty simple and basically calls a powershell script?

I did manually run the script from a WIndows 7 client and it worked
David Johnson, CD, MVPOwnerCommented:
ensure that it is run on the user level and not the machine level.
Data collected on: 25-Aug-2014 10:19:19 PM hide all 

The settings in this GPO can only apply to the following groups, users, and computers:Name 
NT AUTHORITY\Authenticated Users 
Computer Configuration (Enabled)hide
No settings defined.
User Configuration (Enabled)hide
For this GPO, Script order: Windows PowerShell scripts will run lastName Parameters 

Open in new window

If you have a powershell scripts folder in group policy
you may have to call a batch file
%systemroot%\System32\Powershell.exe -executionpolicy remotesigned -File .\yourscriptname.ps1   -noprofile

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I believe the .PS1 script has to be applied from the PowerShell Scripts tab, or else it will just be opened with Notepad.  If you don't have that option (you might try managing GP from a Win7/2008R2 machine), then I think you will have to create a batch script to call the .PS1 script (as David mentioned), and call the batch script from GP.
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

Jerry SeinfieldAuthor Commented:
can you please provide an example of the batch script to be create to call the PST script? and the exact path where this batch must be placed?
David provided the line.
%systemroot%\System32\Powershell.exe -executionpolicy remotesigned -File .\yourscriptname.ps1   -noprofile

The batch file will be the logon script, so will be under the Netlogon share.   You will want to have the .PS1 script saved in a share location that is reachable, and change the batch command above to reference the path to that .PS1 file.
David Johnson, CD, MVPOwnerCommented:
I thought I said:


Open in new window


Open in new window

The first one is correct and  the second one is wrong
Good eye.  I didn't look to closely at the path.  You could also just reference powershell.exe without the full path, as it is included in the system path.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.