Hi, i want to check if an services have not re started after rebooting some servers. so i thought i'd run this before and after. What i can't work out is how to add the server name before it lists the services for each entry. i just get a long list of services. Any ideas?.
$colComputers = get-content C:\scripts\servers1.txt foreach ($StrComputers in $colComputers)
Ineresting. But what i am after is all in one files something like below so that i can do a compare on the files 9before and after reboot) and find whats changed. So i need to inject the $StrComputers into the output file between each iteration of get-service. hope this makes sense so i know on which server the service has stopped on.
myserver service1 started service2 started
myserver2 service1 started service2 started
by mbuk at 2012-12-06 07:29:30
forgot to say thank for the reply so far.
by mbuk at 2012-12-06 09:03:39
This seems to work. i just change the out-file path after the reboot and then compare the two files.