PS C:\> $Env:COMPUTERNAMEWMIから取得
PS C:\> (Get-WmiObject -Class Win32_ComputerSystem).Name
PS C:\> $Env:COMPUTERNAMEWMIから取得
PS C:\> (Get-WmiObject -Class Win32_ComputerSystem).Name
PS C:\> Rename-Computer -NewName "newhostname" -Force -RestartWMI で実行
PS C:\> $newname = "newhostname" PS C:\> $sysinfo = Get-WmiObject -Class Win32_ComputerSystem PS C:\> $sysinfo.Rename($newname) PS C:\> Restart-Computer