Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-LoggedOnUsers - -WarningVariable variable is not populating #11

Open
C9312B4DC0 opened this issue May 30, 2021 · 1 comment
Open
Labels
help wanted Extra attention is needed

Comments

@C9312B4DC0
Copy link

C9312B4DC0 commented May 30, 2021

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
}
@VertigoRay VertigoRay added the help wanted Extra attention is needed label Jul 8, 2022
@jarod186
Copy link

I also have the same issue, I am using this module to create a list of all currently logged on users for our servers.
Noticed that i got some errors on some servers but i would like to include the error in the output but it seems the message that is sent to the console is neither registered in the error stream nor the warning stream
The result of the script is exported to an excel list so i would like to include any errors in the list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants