Dead_Eyes
asked on
run a powershell script
Hi don't know if this is possible but running a small domain and I have a powershell script to change a few permissions and delete a file and would like to push it out via group policy. So i created a new policy added the script as a startup script in the computer section and selected the GPO option to run powershell scripts as unrestricted. Problem is the script will still not run from GP (even though it runs fine when I right click it and select run with powershell form the network share). After a little research I have discovered this is because the script is still pausing and asking for permission to run and to overcome this I need to sign the script. I don't have a CA and it seems a little much to but a certificate and go though all that mess just to run a simple script. Is there a way around this issue that does not involve me going round every machine and running the script manually?
ASKER
Thanks for the fast reply, do you know if that would that work for:
@echo off
powershell.exe -windowstyle hidden -executionpolicy unrestricted "\\domian\netlgon\Scriptna me.ps1"
and do need to change the exectionpolicy to unrestricted on the GPO or can i just leave it is restricted and the bat file will sort it out? (seems like a good security loophole if you can just use a bat file to change the execution policy lol)
@echo off
powershell.exe -windowstyle hidden -executionpolicy unrestricted "\\domian\netlgon\Scriptna
and do need to change the exectionpolicy to unrestricted on the GPO or can i just leave it is restricted and the bat file will sort it out? (seems like a good security loophole if you can just use a bat file to change the execution policy lol)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@echo off
powershell.exe -windowstyle hidden -executionpolicy unrestricted "Scriptname.ps1"
Try that.