p1.ps1裡面寫到:
$Region = "APAC" # Valid values = "AMER" / "EMEA" / "APAC"
$sms = new-object -comobject “Microsoft.SMS.Client”
if ($sms.GetAssignedSite() –ne “CEN”) { $sms.SetAssignedSite(“CEN”) }
$wmi = get-wmiobject -List "StdRegProv" -Namespace root\default
但我的錯誤訊息如下
New-Object : 無法載入 Microsoft.SMS.Client COM 型別。
位於 D:\p1.ps1:2 字元:18
- $sms = new-object <<<< -comobject “Microsoft.SMS.Client”
- CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
- FullyQualifiedErrorId : CannotLoadComObjectType,Microsoft.PowerShell.Commands.NewObjectCommand
不可在值為 Null 的運算式上呼叫方法。
位於 D:\p1.ps1:3 字元:25
- if ($sms.GetAssignedSite <<<< () –ne “CEN”) { $sms.SetAssignedSite(“CEN”) }
- CategoryInfo : InvalidOperation: (GetAssignedSite:String) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
以上錯誤訊息能否請高人指點一二
