Forum Discussion
Remotely get the start time of a process through Powershell
- Jul 16, 2023
Hi peter_s,
To remotely retrieve the start time of a process using PowerShell, you can utilize the Invoke-Command cmdlet. When running the Get-Process command remotely, the StartTime property may not be available by default. you can try this code:$computerName = "myComputer"
$processName = "myProcess"$startTime = Invoke-Command -ComputerName $computerName -ScriptBlock {
param($procName)
Get-Process -Name $procName | Select-Object -ExpandProperty StartTime
} -ArgumentList $processNameWrite-Host "Start Time: $startTime"
In this code, the Invoke-Commandis used to run the Get-Process command remotely on the specified $computerName. The script retrieves the process using the provided $processName parameter and selects the StartTime property. Finally, the start time is stored in the $startTime variable and displayed.
Invoke-Command (Microsoft.PowerShell.Core) - PowerShell | Microsoft Learn
über Remote - PowerShell | Microsoft Learn
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
Hi peter_s,
To remotely retrieve the start time of a process using PowerShell, you can utilize the Invoke-Command cmdlet. When running the Get-Process command remotely, the StartTime property may not be available by default. you can try this code:
$computerName = "myComputer"
$processName = "myProcess"
$startTime = Invoke-Command -ComputerName $computerName -ScriptBlock {
param($procName)
Get-Process -Name $procName | Select-Object -ExpandProperty StartTime
} -ArgumentList $processName
Write-Host "Start Time: $startTime"
In this code, the Invoke-Commandis used to run the Get-Process command remotely on the specified $computerName. The script retrieves the process using the provided $processName parameter and selects the StartTime property. Finally, the start time is stored in the $startTime variable and displayed.
Invoke-Command (Microsoft.PowerShell.Core) - PowerShell | Microsoft Learn
über Remote - PowerShell | Microsoft Learn
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
- peter_sJul 16, 2023Copper ContributorOkay got it! I was missing computer name and just found out that the process name is case sensitive
invoke-command -computerName myServer -ScriptBlock {Get-Process -name myProcess | select name, id, starttime }