views:

1999

answers:

3

Hello everyone,

How to get local host (machine) name in PowerShell? I am using PowerShell 1.0. Thanks!

regards, George

+7  A: 

You can just use the .NET Framework method:

[System.Net.Dns]::GetHostName()

also

$env:COMPUTERNAME

Strelok
Working, cool! Thanks
George2
+2  A: 

Long form:

get-content env:computername

Short form:

gc env:computername
RaYell
+2  A: 

Add don't forget that all your old console utilities work just fine in PowerShell:

PS> hostname
KEITH1