bziegler
Posts: 5
Score: 0 Joined: 8/26/2008 Status: offline
|
Basically, I want to get to get a compilation of calls to different servers. I want to be able to treat them as 1 object and not multiple objects. So yes, I want an array of objects. $pgmProcesses_total="" $pgmProcesses1="" $pgmProcesses2="" ... $pgmProcesses1=get-WmiObject -computer DEVBOX01 -class Win32_Process -filter "name like `'asn%`'" | select-object -property name, commandLine if ( $pgmProcesses_total = $null) { $pgmProcesses_total = $pgmProcesses1 } else { $pgmProcesses_total = $pgmProcesses_total + $pgmProcesses1 } $pgmProcesses2=get-WmiObject -computer DEVBOX02 -class Win32_Process -filter "name like `'asn%`'" | select-object -property name, commandLine $pgmProcesses_total = $pgmProcesses_total + $pgmProcesses2 The result would be an array, $pgmProcesses_total that had all the objects from both WMI calls, and also any previous calls to retrieve a name and command line. The previous code results in the following error: Method invocation failed because [System.Management.Automation.PSObject] doesn't contain a method named 'op_Addition'. At line 12, position 44 $pgmProcesses_total = $pgmProcesses_total + $pgmProcesses2 Thanks for any help.
|