传递

时间:2016-02-23 10:10:21

标签: powershell wmi

我的MOF文件具有以下功能

[Implemented, WmiMethodId(3)]
void AddCacheDevice( [in, id(0)]string devUUID, [in, id(1)]uint8 role, [out, id(2)] sint32 Status );

我已经尝试了所有我知道的方式来调用WMI方法,比如

$UUID="mpx.mshba0:C2:T0:L0"
$role=1
$wmiconnection= [WMICLASS]"root\wmi:Samsung_CacheConfig"
$MethodParameter = $wmiconnection.psbase.getmethodparameters("AddCacheDevice")
$MethodParameter.role=$role
$MethodParameter.devUUID=$UUID
$wmiconnection.psbase.InvokeMethod("AddCacheDevice",$MethodParameter,$null)

$UUID="mpx.mshba0:C2:T0:L0"
$role=1
$arg=$UUID,$role 
$obj=Get-WmiObject -class "Samsung_CacheConfig" -namespace "root\wmi" 
$obj| Invoke-WmiMethod -Name AddCacheDevice  -ArgumentList $arg

$UUID="mpx.mshba0:C2:T0:L0"
$role=1
$obj=Get-WmiObject -class "Samsung_CacheConfig" -namespace "root\wmi" 
$obj| Invoke-WmiMethod -Name AddCacheDevice  -ArgumentList -devUUID $UUID -role $role

$UUID="mpx.mshba0:C2:T0:L0"
$role=1
$share = Get-WmiObject -Class Samsung_CacheConfig -Namespace "root\wmi"
$mask = $share|Invoke-WmiMethod -Name AddCacheDevice -ArgumentList @($uuid,$role,$null) 

MOF文件

[Implemented, WmiMethodId(3)]
    void AddCacheDevice( [in, id(0)]string devUUID, [in, id(1)]uint8 role, [out, id(2)] sint32 Status );

0 个答案:

没有答案