Using invoke with get-process and Select-object

by rcjay272 at 2013-02-25 07:47:05

All,

I am needing some help with running get-process on remote machines.

I am wanting to get specific objects such as Name, ID , HandleCount, fileversioninfo and each time I run the command against the remote machine i get the following:

PS C:> invoke-command -computername server01 {get-process -name Excel | select-object name,id
>>

My question is why does it go to the prompt >>?
I can

PS C:\Load_Stuff\MonitoringScripts\PowerShell> get-process -name excel | form

I would like to pull this specific objects in the script as seen below…

PS C:\Load_Stuff\MonitoringScripts\PowerShell> get-process -name excel |format-list *


__NounName : Process
Name : EXCEL
Handles : 208
VM : 330530816
WS : 35110912
PM : 18128896
NPM : 31504
Path : C:\PROGRA~1\MICROS~1\Office14\EXCEL.EXE
Company : Microsoft Corporation
CPU : 6.0996391
FileVersion : 14.0.6126.5003
ProductVersion : 14.0.6126.5003
Description : Microsoft Excel
Product : Microsoft Office 2010
Id : 328
PriorityClass : Normal
HandleCount : 208
WorkingSet : 35110912
PagedMemorySize : 18128896
PrivateMemorySize : 18128896
VirtualMemorySize : 330530816
TotalProcessorTime : 00:00:06.0996391
BasePriority : 8
ExitCode :
HasExited : False
ExitTime :
Handle : 2180
MachineName : .
MainWindowHandle : 1521690
MainWindowTitle : Microsoft Excel - Book1
by ArtB0514 at 2013-02-25 08:30:56
You are getting the "continue to enter commands" prompt because you didn’t close the script block with "}". Try this]invoke-command -computername server01 {get-process -name Excel | select-object name,id}[/powershell]