Hi, IT department of company from which my company bought core banking software defined one task in task scheduler on Windows Server 2008 R2 which was triggered by certain event log. As an action they defined sending an email to our IT department. As soon as it is received, one of as (system engineers) has to manually restart one service on that server (in doing so also one more service that depends on the first one will be restarted). By default execution policy on server is restricted.
If I use simple script with just one line restart-service -name servicename -force and add it as an action for task do I need to change execution policy to remotesigned or it can be left as default. When I used PS script and deployed it using GPO I did not need to change execution policy on computers in domain.
Yes. You need an additional line which starts the dependent service.
A little explanation on this:
A service "B" which depends on service "A" means that service B can't run when A is stopped. So, stopping service A will also kill service B.
But starting service A does not mean that B is also being started. So you need to start both of them separately.
I tested by running restart-service -name servicename -force in PS console and it restarted the first service but dependent service was stopped and stayed stopped. It seems that after restart-service -name servicename -force one more line in script is needed start-service -name dependentservicename?
The topic ‘Running PS script as task action’ is closed to new replies.