剖析 OutParameters 物件

SWbemMethod.OutParameters物件是由執行中的提供者方法建立並提供資料。 OutParameters物件的屬性專屬於呼叫的方法。 例如,在下列腳本中,outParam) 中包含的SD (是針對__SystemSecurity.GetSD方法定義的輸出參數。 ReturnValue屬性是適用于所有OutParameters物件的泛型屬性,其中包含作業的結果。

下列程式碼範例說明如何從本機系統類別__SystemSecurity中執行GetSD方法取得輸出參數。

' Connect to WMI root\cimv2 namespace.
Set svc = GetObject("winmgmts:root/cimv2")
' Execute the GetSD method and obtain the output parameters.
set outParam = svc.Execmethod("__SystemSecurity=@", "GetSD")
wscript.echo outparam.ReturnValue
' Format the security descriptor array
' in the SD parameter into one string to display.
objSD  = Join(outparam.SD,",")
wscript.echo objSD
' Release the out parameters object.
set outParam = nothing

如需詳細資訊,請參閱 SWbemMethod.InParameters