powershell远程激活windows

$computer = gc env:computername

$key = "激活密匙"

$service = get-wmiObject -query "select * from SoftwareLicensingService" -computername $computer

$service.InstallProductKey($key)

$service.RefreshLicenseStatus()