How do I get the localhost (machine) name in PowerShell? I am using PowerShell 1.0.
.net – How to get the localhost name in PowerShell
netpowershell
Related Topic
- C# – How to create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office
- C# – What are the correct version numbers for C#
- C# – How to get a consistent byte representation of strings in C# without manually specifying an encoding
- Windows – Setting Windows PowerShell environment variables
- Powershell – Determine installed PowerShell version
- Windows – How to run a PowerShell script
- PowerShell says “execution of scripts is disabled on this system.”
- Powershell – How to comment out code in PowerShell
Best Answer
You can just use the .NET Framework method:
[System.Net.Dns]::GetHostName()
also
$env:COMPUTERNAME