![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | WMI Instances Put Options Hi, Is there any way to supply a PutOptions.Type to the Put method of any WMI Object? For example, I'm trying to create an Instance of MSFT_SIPESUserContactGroupData Class. (msdn.microsoft.com/library/en-us/lcs2005/rtc/msft_sipesusercontactgroupdata.asp?frame=true). $UserContactGroupDataInstance = (New-Object System.Management.ManagementClass("MSFT_SIPESUserContactGroupData")).CreateInstance() $UserContactGroupDataInstance.Name = "Sample Communicator Group" $UserContactGroupDataInstance.UserInstanceID = "{701F0848-998F-934B-B207-2F1DE1282190}" And now I would like to commit it. The MSDN page states that: For PutInstance operations, only the WBEM_FLAG_CREATE_ONLY and WBEM_FLAG_UPDATE_ONLY flags are supported. So, I tried the following way: $PutOptions = New-Object System.Management.PutOptions $PutOptions.Type = 2 $UserContactGroupDataInstance.Put($PutOptions) But, this gives me the following error: Exception calling "Put" with "1" argument(s): "Exception calling "Put" with "0" argument(s): "Provider is not capable of the attempted operation "" At line:1 char:34 + $UserContactGroupDataInstance.Put( <<<< $PutOptions) Does anyone have any idea? Andrey Nepomnyaschih |
My System Specs![]() |
| | #2 (permalink) |
| | Re: WMI Instances Put Options Hi Andrey, Can you try using PsBase to access other overloads of Put() method. V1 of PowerShell do not expose .net methods of the adapted objects. Put method is implemented as a script to address some common scenarios. Can you try the following: $UserContactGroupDataInstance.PsBase.Put($PutOptions) Example: PS C:\Documents and Settings\kriscv> $wmi = gwmi win32_computersystem PS C:\Documents and Settings\kriscv> $wmi.psbase | gm put | fl TypeName : System.Management.Automation.PSMemberSet Name : Put MemberType : Method Definition : System.Management.ManagementPath Put(), System.Management.ManagementPath Put(PutOptions options), System.V oid Put(ManagementOperationObserver watcher), System.Void Put(ManagementOperationObserver watcher, PutOpti ons options) Thanks Krishna[MSFT] "Andrey Nepomnyaschih" <nas@i-free.ru> wrote in message news:e8FRqXqAHHA.3536@TK2MSFTNGP03.phx.gbl... > Hi, > > Is there any way to supply a PutOptions.Type to the Put method of any WMI > Object? > > For example, I'm trying to create an Instance of > MSFT_SIPESUserContactGroupData Class. > (msdn.microsoft.com/library/en-us/lcs2005/rtc/msft_sipesusercontactgroupdata.asp?frame=true). > > $UserContactGroupDataInstance = (New-Object > System.Management.ManagementClass("MSFT_SIPESUserContactGroupData")).CreateInstance() > > $UserContactGroupDataInstance.Name = "Sample Communicator Group" > $UserContactGroupDataInstance.UserInstanceID = > "{701F0848-998F-934B-B207-2F1DE1282190}" > > And now I would like to commit it. The MSDN page states that: > For PutInstance operations, only the WBEM_FLAG_CREATE_ONLY and > WBEM_FLAG_UPDATE_ONLY flags are supported. > > So, I tried the following way: > > $PutOptions = New-Object System.Management.PutOptions > $PutOptions.Type = 2 > > $UserContactGroupDataInstance.Put($PutOptions) > > But, this gives me the following error: > Exception calling "Put" with "1" argument(s): "Exception calling "Put" > with "0" argument(s): "Provider is not capable of the attempted operation > "" > At line:1 char:34 > + $UserContactGroupDataInstance.Put( <<<< $PutOptions) > > Does anyone have any idea? > > Andrey Nepomnyaschih > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: WMI Instances Put Options Hello, Krishna. Yeah, that does work. Thanks a lot, Andrey Nepomnyaschih "Krishna Vutukuri[MSFT]" <kriscv@online.microsoft.com> сообщил/сообщила в новостях следующее: news:uzoZ722AHHA.3928@TK2MSFTNGP03.phx.gbl... > Hi Andrey, > > Can you try using PsBase to access other overloads of Put() method. V1 of > PowerShell do not expose .net methods of the adapted objects. Put method > is implemented as a script to address some common scenarios. Can you try > the following: > > $UserContactGroupDataInstance.PsBase.Put($PutOptions) > > Example: > > PS C:\Documents and Settings\kriscv> $wmi = gwmi win32_computersystem > PS C:\Documents and Settings\kriscv> $wmi.psbase | gm put | fl > > > TypeName : System.Management.Automation.PSMemberSet > Name : Put > MemberType : Method > Definition : System.Management.ManagementPath Put(), > System.Management.ManagementPath Put(PutOptions options), System.V > oid Put(ManagementOperationObserver watcher), System.Void > Put(ManagementOperationObserver watcher, PutOpti > ons options) > > Thanks > Krishna[MSFT] > > > "Andrey Nepomnyaschih" <nas@i-free.ru> wrote in message > news:e8FRqXqAHHA.3536@TK2MSFTNGP03.phx.gbl... >> Hi, >> >> Is there any way to supply a PutOptions.Type to the Put method of any WMI >> Object? >> >> For example, I'm trying to create an Instance of >> MSFT_SIPESUserContactGroupData Class. >> (msdn.microsoft.com/library/en-us/lcs2005/rtc/msft_sipesusercontactgroupdata.asp?frame=true). >> >> $UserContactGroupDataInstance = (New-Object >> System.Management.ManagementClass("MSFT_SIPESUserContactGroupData")).CreateInstance() >> >> $UserContactGroupDataInstance.Name = "Sample Communicator Group" >> $UserContactGroupDataInstance.UserInstanceID = >> "{701F0848-998F-934B-B207-2F1DE1282190}" >> >> And now I would like to commit it. The MSDN page states that: >> For PutInstance operations, only the WBEM_FLAG_CREATE_ONLY and >> WBEM_FLAG_UPDATE_ONLY flags are supported. >> >> So, I tried the following way: >> >> $PutOptions = New-Object System.Management.PutOptions >> $PutOptions.Type = 2 >> >> $UserContactGroupDataInstance.Put($PutOptions) >> >> But, this gives me the following error: >> Exception calling "Put" with "1" argument(s): "Exception calling "Put" >> with "0" argument(s): "Provider is not capable of the attempted operation >> "" >> At line:1 char:34 >> + $UserContactGroupDataInstance.Put( <<<< $PutOptions) >> >> Does anyone have any idea? >> >> Andrey Nepomnyaschih >> >> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Vista Desktop Wallpaper Fit options, I thought there were 5 options? | General Discussion | |||
| 2 Instances of IE running | Vista General | |||
| 2 instances of csrss.exe? | Vista General | |||
| Multiple instances | Vista music pictures video | |||