-1

Would i be able to ask, How would I do a get-process to many machines however for a true or false response to come back for each machine that is running this specific process? however this one specific process only works or is activated when its been run as a specific process and when it is closed it is not showing as running or a background process.

I would like it to look like

S1 True $running C1 True $running C2 False $notrunning C3 True $running C4 True $running

the process is called 'nominate.exe' and would like to run this remote command ,but cannot think how i would start.

Mofi
  • 46,139
  • 17
  • 80
  • 143
  • `wmic /node:@"%userprofile%\Desktop\ComputerName.txt" process where "Name='Notepad.exe'" Get Processid /format:csv`. To get a list of turned on computers `for /f "skip=3 delims=\" %A in ('net view ^| findstr /v /C:"The command completed successfully"') do Echo %A >> "%userprofile%\Desktop\ComputerName.txt"` –  May 01 '20 at 20:33

1 Answers1

1

You can use PowerShell and the Get-Process cmd to check multiple systems to see if they're running a process or not. If they are, they return a result. If not, they do not.

 Get-Process -ComputerName dc2016 -Name "Notepad","MSPaint","Excel" -Verbose | select MachineName,ProcessName

MachineName ProcessName
----------- -----------
dc2016      mspaint    
dc2016      notepad    

From there, you can store the outputs in a variable and then act on it in some other way, but this is how you'll get started.

Note: You'll need to enable PowerShell Remoting on the remote computers by Group Policy or by running Enable-PSRemoting from an Elevated PowerShell prompt.

FoxDeploy
  • 12,569
  • 2
  • 33
  • 48