Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

get a service from a list of remote computers.

$
0
0

Hi,

I run this:

$ComputerList = Get-Content -Path "P:\Tools\x64.txt"
$ComputerList | foreach { (Get-Service -Name YAM* -computername $_) | Select-Object MachineName, Name, DisplayName, Status}
<# Need to add another line to extract if YAM is not installed  #>
$ComputerList | foreach -ne { (Get-Service -Name YAM* -ComputerName $_) | Select-Object MachineName}

The first two lines produce the expected result.  The last line i can not get to work.  I am looking to list computers that do not have the service installed.  for example if i have pc1, pc2 and pc3, pc4 i the list, and 1 and 2 have the service,  i would like to get a list as below

MachineName                Name                  DisplayName                          Status

pc1                                 Yam                           Yam                                 Running

pc2                                  Yam                          Yam                                 Running

pc3      

pc4

any thoughts.

Thanks in advance.                 


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>