Author Topic: Using WMI Methods  (Read 3273 times)

bettman

  • Newbie
  • *
  • Posts: 42
Using WMI Methods
« on: September 10, 2014, 10:18:48 am »
Greetings,

Could you briefly outline how to invoke a method from a WMI class? Specifcally I am trying to use the GetConversionStatus method of the Win32_EncryptableVolume class to determine what the status of the encryption process is on a workstation.

Any help would be appreciated.

Thank you.

td

  • Tech Support
  • *****
  • Posts: 3985
    • WinBatch
Re: Using WMI Methods
« Reply #1 on: September 10, 2014, 11:26:46 am »
Here is an example while not showing the specific member you mentioned do demonstrate using the class:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/WMI+Win32_EncryptableVolume.txt

The Tech Database has a whole section devoted to WMI topics including script creation tools.  Just click on the Tech Database menu item at the top of this page -> click the left-hand-side WinBatch -> scroll down -> click WMI.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

bettman

  • Newbie
  • *
  • Posts: 42
Re: Using WMI Methods
« Reply #2 on: September 10, 2014, 11:31:07 am »
In the example you provided, which line refers to the method? (as you can tell I really don't have a good understanding of WMI)

Thank you for your help.

td

  • Tech Support
  • *****
  • Posts: 3985
    • WinBatch
Re: Using WMI Methods
« Reply #3 on: September 10, 2014, 01:21:52 pm »
As mentioned previously there isn't a call to the method but it would look something like the following

Code: Winbatch
   ; ... example's code .....

   If objInstance.ProtectionStatus == 1
      strStatus = "PROTECTION ON"
      nEncryptionPercentage = 0  ; Out
      nEncryptionFlags = 0  ; Out
      nWipingStatus = 0  ; Out
      nWipingPercentage = 0  ; Out
      nPrecisionFactor = 2  ; In/out (1 - 4)
      objInstance.GetConversionStatus(  nEncryptionPercentage, nEncryptionFlags, nWipingStatus , nWipingPercentage,     nPrecisionFactor)  
  EndIf

  ; Handle out parameters of method call in whatever fashion requirements dictate.
 


The class documentation can be found here

http://msdn.microsoft.com/en-us/library/aa376433(v=vs.85).aspx
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade