Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get process ID from a remote computer

Status
Not open for further replies.

Tester_V

Technical User
Nov 22, 2019
54
0
0
US
Greetings!
I have never used PS.
I'm trying to get PS script to get processes running on a remote computer.
Microsoft documents have this example "Get-Process -Name PowerShell -ComputerName localhost, Server01, Server02"
But like everything at Microsoft, it is confusing and not clear.
I tried this:
Code:
 Get-Process powershell -ComputerName someone-desk2
 Get-Process powershell -someone-desk2
 Get-Process powershell -ComputerName localhost,someone-desk2
Nothing is working...
Thank you

 
Do you get any response from

[tt]Get-Process powershell[/tt]


Powershell would normally give you an error if it is not working. What is the error?
 
Here is the error:
Code:
 Get-Process : Couldn't connect to remote machine.
At line:1 char:2
+  Get-Process powershell -ComputerName desk2
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Process], InvalidOperationException
I can ping the "desk-2" and can remotely log in to it...
 
I really do not know anything about the PS, I found this code on the Microsoft website.
Just FYI, the target PC is running W10 Enterprise
 
You haven't mentioned what versions of Windows and PowerShell you are using. Get-Process in the default versions of PowerShell in Windows 7, 8.x and 10/11 doesn't have remote capability on its own. You need to use PowerShell Remoting (set up on the destination devices) and use Invoke-Command from the source device. (The Microsoft docs probably refer to PowerShell 7.)

Have a look at the following article - How to Find Running Processes with PowerShell’s Get-Process Cmdlet - particularly the Finding Processes on Remote Computers section. The article includes a link about setting up PowerShell Remoting. It's what I used... :)

Hope this helps...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top