Add support for generating collectors from remote systems
This commit is contained in:
parent
b4ca3412dd
commit
9ea0c95ca5
|
@ -2,9 +2,22 @@ Param(
|
|||
[Parameter(Mandatory=$true)]
|
||||
$Class,
|
||||
[Parameter(Mandatory=$false)]
|
||||
$CollectorName = ($Class -replace 'Win32_PerfRawData_Perf','')
|
||||
$CollectorName = ($Class -replace 'Win32_PerfRawData_Perf',''),
|
||||
[Parameter(Mandatory=$false)]
|
||||
$ComputerName = "localhost",
|
||||
[Parameter(Mandatory=$false)]
|
||||
$Credential
|
||||
)
|
||||
$members = Get-WMIObject $Class `
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if($Credential -ne $null) {
|
||||
$wmiObject = Get-WMIObject -ComputerName $ComputerName -Credential $Credential -Class $Class
|
||||
}
|
||||
else {
|
||||
$wmiObject = Get-WMIObject -ComputerName $ComputerName -Class $Class
|
||||
}
|
||||
|
||||
$members = $wmiObject `
|
||||
| Get-Member -MemberType Properties `
|
||||
| Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `
|
||||
| Select-Object Name, @{Name="Type";Expression={$_.Definition.Split(" ")[0]}}
|
||||
|
|
Loading…
Reference in New Issue