Function Set-ComputerName
{
param
(
[Parameter(Mandatory = $true, Position = 0)] [string] $ComputerName
)
$computer=Get-WMIObject Win32_ComputerSystem
#设置计算机名
$computer.Rename( $ComputerName ) | out-null
Restart-Computer -Force
}
推荐一个学习基金知识的公众号:贫民的财富自由之路