When attempting to use the Get-LoggedOnUsers, I tried to use the -WarningVariable parameter to capture all servers that had WMI and RPC warnings.
When accessing the Warning Variable, the output is empty.
Example:
Process {
if ( $PsCmdlet.ParameterSetName -like 'SingularHost' ) {
$LoggedOnUsers = Get-LoggedOnUsers -Computer $ComputerName -WarningAction SilentlyContinue -WarningVariable WarningOutput
}
else {
$LoggedOnUsers = Get-EnabledADComputers -HostType $HostType | Get-LoggedOnUsers -Property DNSHostName -WarningAction SilentlyContinue -WarningVariable WarningOutput
}
$WarningOutput | Measure-Object #---> Output is zero
($WarningOutput).Count #---> Output is zero
}
When attempting to use the Get-LoggedOnUsers, I tried to use the -WarningVariable parameter to capture all servers that had WMI and RPC warnings.
When accessing the Warning Variable, the output is empty.
Example: