MongolianNoseFlute
asked on
How to run power shell script via GPO in a server 2003 environment
Hi. I have a powershell script I intend to use to remove software from targeted computers within an OU. I have the commands to remove the software and they work (below). I wish to push this out via GPO but am unsure how. I know the execute command needs to be enabled on all client machines for power script to work so not sure what I can do here.
$app = Get-WmiObject –Class Win32_Product | Where-Object {
$_.Name –match “xxxx xxx xxxxxx”}
$app.uninstall()
$app = Get-WmiObject –Class Win32_Product | Where-Object {
$_.Name –match “xxxx xxx xxxxxx”}
$app.uninstall()
ASKER
Thanks for the reply but I am not entirely sure what to do here.
In GPO editor I can go to User configuration - Windows Settings - Scripts (logon/logoff) and point to my ps1 file which is in a shared folder but I know that will not work.
You say run: C:\windows\system32\window spowerShel l\v1.0\pow ershell.ex e but how? I know I can make it run but how do I make it run and execute the script?
Thanks for the help!! :)
In GPO editor I can go to User configuration - Windows Settings - Scripts (logon/logoff) and point to my ps1 file which is in a shared folder but I know that will not work.
You say run: C:\windows\system32\window
Thanks for the help!! :)
In GPO editor, when you browse, it should automatically specify a location (i.e. domain.com\SYSVOL\Policies \{LONGSTRI NGOFGPO}\U ser\Script s\Logon\ )
Drop your PS1 file there, not on your share. It should sit where your GPO sits.
Are you running windows xp or windows 7?
With windows xp, make sure that powershell is installed on the workstations (available via Microsoft windows update - you should be able to simply approve this update), all you simply need to do is point to that PS1 file.
No need to put extra commands to run the powershell.
Making sure powershell is installed on older clients: (windows xp)
http://support.microsoft.com/kb/968929
Drop your PS1 file there, not on your share. It should sit where your GPO sits.
Are you running windows xp or windows 7?
With windows xp, make sure that powershell is installed on the workstations (available via Microsoft windows update - you should be able to simply approve this update), all you simply need to do is point to that PS1 file.
No need to put extra commands to run the powershell.
Making sure powershell is installed on older clients: (windows xp)
http://support.microsoft.com/kb/968929
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://serverfault.com/questions/372061/how-do-i-execute-a-powershell-script-via-group-policy