PowerShell Functions to Get Logged On User and Logoff Logged On User

Two helpful PowerShell functions to help you check who is logged on remotely and to remotely log them off. Remotely Get a Logged On User This Get-LoggedOnUser will use Get-WmiObject to tell you who is logged on to a remote computer. You may use a comma-delimited list of computer names. Function: 1 2 3 4 …

Running PowerShell as different user

If you want to launch PowerShell as a different user other than administrator, you won’t find a Run As menu to enter other credentials. After a bit of searching, I found that the following code works best in launching a new PowerShell windows as a different user. 1 2 3 4 5 6 7 8 …