Hi guys,
Learning powershell and enjoying every minute of it.
At work, we have a morning checklist, and one of the items is for checking the status of some services on a server.
I can check the services status individually in a script 1 line at a time, but I want to use an array and pass it to the get-service command. This will definitely advance my powershell scripting knowledge.
What I have so far is 8 lines running the get-service command for each service and a pause command at the end so the console doesn’t close on me.
get-service -computername servername | where-object {$_.name -eq ‘ServiceName’}
So far in my research, I know that a variable is needed: $servicelist = @(‘service1’,‘service2’,‘service3’)
Also, probably the use of foreach. Just need to know how to put it all together.
Thank you.
“Give a man a fish and feed him for a day; teach a man to fish and you feed him for a lifetime.”