cancel
Showing results for 
Search instead for 
Did you mean: 

Powershell Script executed via group policy

Former Member
0 Kudos

We have a distributed sap environment. I've written a powershell script to run at shutdown and startup of the database server. This will stop and start the sap application on various app servers when the sa's want to patch the db server.

The script works great when run from powershell, or task scheduler. No problems.

However, when I run the shutdown from a local group policy I get the following errors -

"SAPSRVKILL failed on wsapecctrn01_ect_00: Access is denied., CreateFile failed in plugin_pipefopen()

Error occured when waiting for halt on wsapecctrn01_ect_00."

Under group policy it's being executed differently or under a different user or permissions then when from powershell or the task scheduler.

Any help would be appreciated.

Also, is there anyway to execute a script via group policy w/o rebooting the server?

Thanks,

Daniel

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hey Daniel,

I'm not a powershell guru, but you're on the right track regarding permissions, since it runs while logged on. Maybe the runas cmdlet or invoke-command.

This link may help:http://gallery.technet.microsoft.com/scriptcenter/PowerShell-function-to-3e9766e3

Also, you can set the GPO as a Logon/Logoff script, then run gpupdate /force. This forces the GPO to take effect. Then you'll just have to logoff and on to test the script.

former_member182675
Contributor
0 Kudos

HI

User (SIDADM) should be in administrators group

Check it

Naor