Given below are three methods (there could be more) of determining your Hostname in PowerShell:
METHOD 1:
# Fastest method PS C:\> $env:COMPUTERNAME
METHOD 2:
# Slowest method PS C:\> $(Invoke-Expression hostname)
METHOD 3:
PS C:\> [System.Net.Dns]::GetHostName()
(Visited 106 times, 1 visits today)