Start Windows Services
hello all,
newbie here.
i trying write powershell script start number of windows services , notify me status of services.
here steps , descriptions:
1) start multiple windows services (service1, service2, service3, service4)
case 1) if start , enter "running" status, notify me via email status of above services in format:
service1 - running
service2 - running
service3 - running
service4 - running
case2 ) if or of services fail start or throw errors, notify me via email status/errors of above services in format:
service1 - running
service2 - error (whatever error powershell gets)
service3 - error
service4 - stopped
==================
i can status of each of service doing:
get-service -name "service1","service2","service3","service4"
which return:
status,name,displayname
stopped,service1,service1
stopped,service2,service2
running,service3,service3
running,service3,service3
i can start services doing:
start-service -name "service1","service2","service3","service4",
here factors stuck on:
1) these services can started simultaneously, they can take time start.
2) if service fails start first time, try start second time
3) if fails start second time, store error variable , email me status and/or error messages during start.
i hope explains trying accomplish.
your appreciated!
justin rich
http://jrich523.wordpress.com
powershell v3 guide (technet)
please remember mark replies answers if , unmark them if provide no help.
Windows Server > Windows PowerShell
Comments
Post a Comment