47 lines
933 B
PowerShell
47 lines
933 B
PowerShell
<#
|
|
.Synopsis
|
|
Short description
|
|
.DESCRIPTION
|
|
Long description
|
|
.EXAMPLE
|
|
Example of how to use this cmdlet
|
|
.EXAMPLE
|
|
Another example of how to use this cmdlet
|
|
#>
|
|
function Get-PropertyObjectTest
|
|
{
|
|
[CmdletBinding()]
|
|
Param
|
|
(
|
|
[string[]]
|
|
$ProcessName
|
|
)
|
|
|
|
Begin
|
|
{
|
|
}
|
|
Process
|
|
{
|
|
$MyArrayList = [System.Collections.ArrayList]@()
|
|
$null = $MyArrayList.Add($obj)
|
|
ForEach ($Process in $ProcessName)
|
|
{
|
|
$Output = Get-Process -Name $Process
|
|
|
|
$obj=[PSCustomObject]@{
|
|
'ProcessName' = $Output.Name;
|
|
'CPU' = $Output.CPU -as [int];
|
|
'VMGB' = $Output.VirtualMemorySize64 / 1GB -as [int];
|
|
'WSMB' = $Output.WorkingSet64 / 1MB -as [int];
|
|
}
|
|
|
|
#Write-Output $obj
|
|
$null = $MyArrayList.Add($obj)
|
|
}
|
|
}
|
|
End
|
|
{
|
|
}
|
|
}
|
|
|