Multiple choice technology

Which of the below commands finds out the last logged on users in a Local/Remote systems?

  1. Gwmi Win32_Computersystem -Comp “.” | Select Name, UserName

  2. Get-WMIObject Win32_Computersystem -Comp “.” | Select Name, UserName

  3. Get-WMIObject Win32_Computersystem -Comp “localhost” | Select Name, UserName

  4. all of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

All three commands are equivalent. gwmi is an alias for Get-WMIObject. Both '.' and 'localhost' refer to the local computer. Win32_Computersystem has a UserName property that shows the last logged-on user. Since all commands perform the same operation (just with different syntax), 'all of the above' is correct.