Thursday, February 23, 2012
   
Text Size

PowerShell - Get Current Computer Name

 

Windows PowerShell - Get Current Computer Name

windows_powershell

 To get the currently logged on UserName:

$CS = Gwmi Win32_ComputerSystem -Comp "."
"Machine Name: " + $CS.Name