SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Win32
Introduction to Perl & WMI
WMI?

•   What Means It?
•   Who Made It?
•   What Makes It tick?
•   Where Might I use it for?
Who Made It?
• Set of Standards created by DMTF
 (Desktop Management Task Force   Distributed Management Task Force)
What Means It?
• Set of Standards created by DMTF
  (Desktop Management Task Force   Distributed Management Task Force)



Consisting of:
  DMI (Desktop Management Interface)
  WBEM (Web-Based Entreprise Management)
  CIM (Common Interface Model)

Bundled together known as Windows Meta Instrumentation.
What Makes It tick? (1)
Namespace(s)


Provider       Provider


Class(es)      Class(es)   Class(es)
What Makes It tick? (2)
Namespace(s)


Provider       Provider


Class(es)      Class(es)                      Class(es)



                           WMI Layer


                     COM-API, SCRIPTING API


                            OS Layer
What Makes It tick? (3)
Namespace(s)


Provider                      Provider


Class(es)                     Class(es)                                Class(es)



                                            WMI Layer


                                    COM-API, SCRIPTING API


                                             OS Layer



                                 WMI Classes, Objects & Properties

                                  COM-API, SCRIPTING-API, ...

                     OS Specific Binaries, Registry, WBEM MIF & MOF Files, ...

    NT4        W2K       W2K3              W2K8              XP            Vista   ...
Where Might I use it for?

A Quick & quot;Uniformquot;
     Development Interface
     Reporting Interface
     Device Management Interface
Wow My…It even has a                                                 Wizard ;-)
          quot;Scriptomaticquot;
•   quot;A completely new version of the famous Scriptomatic, the utility that
    writes WMI scripts for you.
    (And, in the process, teaches you the fundamental concepts behind
    writing WMI scripts for yourself.)
•   Unlike its predecessor, Scriptomatic 2.0 isn’t limited to writing just
    VBScript scripts; instead, Scriptomatic 2.0 can write scripts in Perl,
    Python, or JScript as well.
•   In addition, Scriptomatic 2.0 gives you a host of new output formats to
    use when running scripts, including saving data as plain-text, as a
    stand-alone Web page, or even as XML. Scriptomatic 2.0 handles arrays,
    it converts dates to a more readable format, and it works with all the
    WMI classes on your computer; on top of all that, it also writes scripts
    that can be run against multiple machines.“*
    *Quote Microsoft Download Center




    Download: http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119-
    b7eb-783b0f7d1178&DisplayLang=en
Example Perl WMI Query
1.    use strict;
2.    use Win32::OLE('in');

3.    use constant wbemFlagReturnImmediately => 0x10;
4.    use constant wbemFlagForwardOnly => 0x20;

5.    my @computers = (quot;.quot;);
6.    foreach my $computer (@computers) {
7.       my $objWMI = Win32::OLE->GetObject(quot;winmgmts:$computerrootCIMV2quot;)
                      or die quot;WMI connection failed.nquot;;
8.       my $colItems = $objWMI->ExecQuery(quot;SELECT * FROM Win32_NetworkAdapterquot;, quot;WQLquot;,
9.                      wbemFlagReturnImmediately | wbemFlagForwardOnly);

10.     foreach my $objItem (in $colItems) {
11.        print (quot;TimeOfLastReset: quot;
12.               .UTCDate($objItem->{TimeOfLastReset}).quot;nquot;);
13.        print quot;TimeOfLastReset: $objItem->{TimeOfLastReset}nquot;;
14.        print quot;nquot;;
15.     }
16. }

17.   sub UTCDate(){
18.         my $WmiDate = qr/(d{4})(d{2})(d{2})(d{2})(d{2})
19.                        (d{2}).(d{6})([+-])(.*)$
20.                       /ox;
21.      $_[0] =~ s/$WmiDate/$1 $2 $3 $4h $5m $6s (UTC$8$9m)/;
22.      return $_[0];
23.   }
24.   #TimeOfLastReset: 20071027003940.826905+120
25.   #TimeOfLastReset: 2007 10 27 00h 39m 40s (UTC+120m)
Connecting Perl to WMI (1)
• Moniker
1.    use Win32::OLE('in');
2.    use strict;
3.    $strComputer = '.';
4.    $objWMI      = Win32::OLE->GetObject('winmgmts:' . $strComputer .
                     'rootcimv2');




Constructing a Moniker String: http://msdn2.microsoft.com/en-us/library/aa389292.aspx
Connecting Perl to WMI (2)
•      SWBEM Locator
1.     use Win32::OLE('in');
2.     use strict;
3.     my $objWMILocator = Win32::OLE->CreateObject(quot;WbemScripting.SWbemLocatorquot;);
4.     $objWMILocator->Security_->{AuthenticationLevel} = 6;
5.     my $objWMIComputer = $objWMILocator->ConnectServer($strComputer, quot;rootcimv2quot;,
                            $strLocalUser, $strLocalPasswd);




Connecting to WMI on a Remote Computer: http://msdn2.microsoft.com/en-us/library/aa389290.aspx
WQL (SQL for WMI)
                        AND                     NOT
                        ASSOCIATORS OF          NULL
                        FALSE                   OR
                        FROM                    REFERENCES OF
                        GROUP Clause            SELECT
                        HAVING                  TRUE
                        IS                      WHERE
                        ISA                     WITHIN
                        KEYSONLY                __CLASS
                        LIKE




WQL (SQL for WMI): http://msdn2.microsoft.com/en-us/library/aa394606.aspx
WQL - ExecQuery
1.     my $objWMI   = Win32::OLE->GetObject(quot;winmgmts:$computerrootCIMV2quot;)
                      or die quot;WMI connection failed.nquot;;
2.     my $colItems = $objWMI->ExecQuery(quot;SELECT * FROM Win32_NetworkAdapter“,
                      quot;WQLquot;, wbemFlagReturnImmediately | wbemFlagForwardOnly);
3.     foreach my $objItem (in $colItems) {
4.       print ( quot;TimeOfLastReset: quot;
5.              . UTCDate($objItem->{TimeOfLastReset}).quot;nquot;);
6.       print quot;TimeOfLastReset: $objItem->{TimeOfLastReset} nnquot;;
7.     }




Calling a Method: http://msdn2.microsoft.com/en-us/library/aa384832.aspx
WbemFlagEnum: http://msdn2.microsoft.com/en-us/library/Aa393980.aspx
Example Perl WQL ‘Associators Of’
1.    use win32::ole;
2.    use strict;
3.    my $objWMI = Win32::OLE->GetObject('winmgmts:.rootcimv2')
                    or die quot;WMI connection failed.nquot;;
4.    my $colNAs = $objWMI->ExecQuery( 'select * ' . ' from Win32_NetworkAdapter' );
5.    foreach my $objNA( in $colNAs) {
6.        my $colSubNAConfig =
7.             $objWMI->ExecQuery( 'ASSOCIATORS OF {Win32_NetworkAdapter.DeviceID=''
8.                                 . $objNA->DeviceID . ''} '
9.                                 . ' WHERE resultClass = '
10.                                . ' win32_NetworkAdapterConfiguration' );
11.       foreach my $objNAConfig ( in $colSubNAConfig ) {
12.           if ( $objNAConfig->DHCPEnabled == 1 ) {
13.               my $intReturnCode = $objNAConfig->RenewDHCPLease();
14.               if ( $intReturnCode == 0 ) {
15.                    print quot;Renewed IP Configuration for quot;.$objNA->Name ;
16.               }
17.               elsif ( $intReturnCode == 1 ) {
18.                    print quot;You must reboot to renew the IP Configuration for quot;
19.                          .$objNA->Name ;
20.               }
21.           }
22.       }
23.   }
WMI UTC Date/Time (1)
Based on the CIM datetime/interval format
Formatting: yyyymmddHHMMSS.mmmmmmsUUU or yyyy-mm-dd HH:MM:SS:mmm

1.   foreach my $objItem (in $colItems) {
2.         print (quot;TimeOfLastReset: quot;
                  .UTCDate($objItem->{TimeOfLastReset})
3.
4.                .quot;nquot;);
5.         print quot;TimeOfLastReset: $objItem->{TimeOfLastReset}nquot;;
6.         print quot;nquot;;
7.      }
8.   }

9. #TimeOfLastReset: 20071027003940.826905+120
10. #TimeOfLastReset: 2007 10 27 00h 39m 40s (UTC+120m)
WMI UTC Date/Time (2)
Based on the CIM datetime/interval format
Formatting: yyyymmddHHMMSS.mmmmmmsUUU or yyyy-mm-dd HH:MM:SS:mmm


1. sub UTCDate(){
2.      my $WMIDate           =   $_[0];
3.         $WMIDate           =~ s/[^0-9-+]//gis;
4.      my $WmiDateRaw        =   qr/(d{4})(d{2})(d{2})
5.                                   (d{2})(d{2})(d{2})
6.                                   (d{6})([+-])(.*)$
7.                                  /ox;
8.      my $WmiDateFormatted =    qr/(d{4})-?(d{2})-?(d{2})
9.                                   (d{2})(d{2})(d{2})
10.                                  (d{3})$
11.                                 /ox;
12.     if ($WMIDate =~ s/$WmiDateRaw/$1 $2 $3 $4h $5m $6s (UTC$8$9m)/){
13.         return $WMIDate;
14.     };
15.     if ($WMIDate =~ s/$WmiDateFormatted/$1 $2 $3 $4h $5m $6s/){
16.         return $WMIDate;
17.     };
18. }
19. #TimeOfLastReset: 20071027003940.826905+120
20. #TimeOfLastReset: 2007 10 27 00h 39m 40s (UTC+120m)
WMI Practical: ‘Route Print’
1.   use strict;
2.   use Win32::OLE('in');

3.   use constant wbemFlagReturnImmediately => 0x10;
4.   use constant wbemFlagForwardOnly => 0x20;

5.   my $objWMIService = Win32::OLE->GetObject(quot;winmgmts:localhostrootCIMV2quot;)
6.                       or die quot;WMI connection failed.nquot;;

7.  my $colItems = $objWMIService->ExecQuery(quot;SELECT * FROM Win32_IP4RouteTablequot;,
                    quot;WQLquot;,
                    wbemFlagReturnImmediately | wbemFlagForwardOnly);
8.    if (Win32::GetLastError()){
9.    #     Do Error Handling.
10. };
11. print quot;Destinationtquot;.quot;InterfaceIndextquot;.quot;Mask:tquot;.quot;Metric1:tquot;.
          quot;Name:tquot;.quot;NextHop:tquot;.quot;Type:tquot;.quot;Protocol:nquot;;
12. print ‘-’ x 78;

13. foreach my $objItem ( in $colItems) {
14.     print quot;$objItem->{Destination}tquot;;
15.     print sprintf quot;0x%xquot;, $objItem->{InterfaceIndex}.quot;tquot;;
16.     print quot;$objItem->{Mask}t“.quot;$objItem->{Metric1}tquot;;
17.     print quot;$objItem->{Name}t“.quot;$objItem->{NextHop}tquot;;
18.     print quot;$objItem->{Type}t“.print quot;$objItem->{Protocol}nquot;;
19. }
WMI Practical: ‘Route Add’
1.    use Win32::OLE;
2.    use strict;

3.    my $strComputer = '.';
4.    my $objLocator = Win32::OLE->new('WbemScripting.SWbemLocator');
5.    my $objWMI      = $objLocator->ConnectServer($strComputer, 'root/CIMv2');

6.    my $objRoute = $objWMI->Get('Win32_IP4RouteTable')->SpawnInstance_();

7.    $objRoute->{Destination}      =   '0.0.0.0';
8.    $objRoute->{NextHop}          =   '10.10.0.1';
9.    $objRoute->{Mask}             =   '0.0.0.0';
10.   $objRoute->{InterfaceIndex}   =   0x10006;
11.   $objRoute->{Metric1}          =   1;
12.   $objRoute->{Protocol}         =   1;
13.   $objRoute->{Type}             =   4;

14. $objRoute->Put_();

15. if (Win32::GetLastError()){
16.     print quot;WMI Error: quot;.Win32::GetLastError().quot;nquot;;
17.     $intReturnCode &= 0;
18. };

19. #route add 0.0.0.0 MASK 0.0.0.0 10.10.0.1
WMI Practical: ‘Route Delete’
1.     my $objWMI = Win32::OLE->GetObject('winmgmts:.rootcimv2');
2.     for ( my $j = 0; $j < $i; $j++ ) {
3.         #     open and delete local wmi instance
4.         $objWMI->Delete( 'Win32_IP4RouteTable.Destination='‘
                           . $Destination
                           . '',NextHop='‘
                           . $NextHop[$j]
                           . ''' );
5.         if ( Win32::GetLastError() ) {
6.             print quot;Could not delete the route gateway. quot;
7.                   . $NextHop[$j]
8.                   . quot;. WMI Error: quot;
9.                   . Win32::GetLastError() . quot;nquot;;
10.            $intReturnCode &= 0;
11.        }
12.        else {
13.            print quot;Route gateway quot; . $NextHop[$j] . quot; deletedquot; ;
14.            $intReturnCode &= 1;
15.        }
16.    }
WMI Practical: ‘Refreshing quot;PerfMon Dataquot;’
VBS
   PLS
         PL




Accessing Performance Data : http://msdn2.microsoft.com/en-us/library/Aa384728.aspx
WMI Practical: ‘Refreshing’
• VBS (`cscript script.vbs`)
1.   ' Get the performance counter instance for the System process
2.   set Perf = GetObject(quot;winmgmts:Win32_PerfFormattedData_PerfOS_Processor.name=‘0'quot;)
3.   ' Display some properties in a loop
4.   for I = 1 to 5
5.       Wscript.Echo quot;Perf PercentIdleTime = quot; & Perf.PercentIdleTime
6.       Wscript.Sleep 2000
7.   ' Refresh the objects
8.       Perf.Refresh_
9.   next




 C:>cscript Demo_Refresher.vbs
 Microsoft (R) Windows Script Host Version 5.6
 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

 Perf   PercentIdleTime   =   100
 Perf   PercentIdleTime   =
 Perf   PercentIdleTime   =   100
 Perf   PercentIdleTime   =   96
 Perf   PercentIdleTime   =   96

 C:>
WMI Practical: ‘Refreshing’
•     PLS (`cscript script.pls`)
1.     use Win32::OLE qw(in);
2.     use strict;
3.
4.     my $Perf = Win32::OLE->GetObject(
         quot;winmgmts:Win32_PerfFormattedData_PerfOS_Processor.name=‘0'quot;);
5.     for (my $i = 1;$i <= 5 ;$i++){
6.         sleep 5;
7.         $Perf->Refresh_();
8.      print quot;PercentIdleTime: $Perf->{PercentIdleTime}nquot;;
9.     }




    C:>cscript Demo_Refresher.pls
    Microsoft (R) Windows Script Host Version 5.6
    Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

    Perf   PercentIdleTime   =   100
    Perf   PercentIdleTime   =
    Perf   PercentIdleTime   =   96
    Perf   PercentIdleTime   =   93
    Perf   PercentIdleTime   =   97

    C:>
WMI Practical: ‘Refreshing’
•     PL (`perl script.pl`)
1.  use Win32::OLE qw(in);
2.    use strict;
3.    for (my $i = 1;$i <= 5 ;$i++){
4.        my $Perf = Win32::OLE->GetObject(
                       quot;winmgmts:Win32_PerfFormattedData_PerfOS_Processor.name='0'quot;);
5.        print quot;PercentIdleTime: $Perf->{PercentIdleTime}nquot;;
6.        $Perf->DESTROY;
7.        $Perf = quot;Unknownquot;;
8.        $Perf = undef;
9.        sleep 2;
10.   };



    C:>perl Demo_Refresher.pl
    PercentIdleTime: 96
    PercentIdleTime: 93
    PercentIdleTime: 100
    PercentIdleTime: 96
    PercentIdleTime: 96

    C:>
WMI Practical: ‘Data Dumping’
•   WQL Query
•   Enumerate WMI object
•   Generate XML Dumps
WMI Practical: ‘WQL Query’
•   Cf. Slide ‘WQL – ExecQuery’
WMI Practical: ‘Enumerate WMI object’
1.    my $strWMIClass = quot;win32_biosquot;;
2.    my $objWMI      = Win32::OLE->GetObject(quot;WinMgmts:quot;)->InstancesOf(quot;win32_biosquot;);
3.    print(   ( '-' x 78 ) . quot;n quot;
4.           . quot;Obtaining that object's data in an enumerated way.nquot;
5.           . ( '-' x 78 ) . quot;nquot; );
6.    my $pad_len = 30;
7.    foreach my $objItem ( in $objWMI) {
8.    print(            sprintf( quot;%-*squot;, $pad_len, quot;WMI Classquot; ) . quot;: quot;
9.                   . $strWMIClass . quot;nquot;
10.                  . sprintf( quot;%-*squot;, $pad_len, quot;Name quot; ) . quot;: quot;
11.                  . sprintf( quot;%-*squot;, $pad_len, $objItem->Name ) . quot;nquot; );
12.       foreach my $objProp ( in $objItem->Properties_ ) {
13.           if ( !( $objProp->Value ) ) {
14.               print( sprintf( quot;%-*squot;, $pad_len, $objProp->Name ) . quot;: NULLnquot; );
15.           }
16.           elsif ( $objProp->IsArray == 1 ) {
17.               foreach my $i ($objProp) {
18.                   print( sprintf( quot;%-*squot;, $pad_len, $objProp->Name ) . quot;: quot;
19.                               . $objProp->Value($i) . quot;nquot; );
20.               }
21.           }
22.           elsif ( $objProp->IsArray != 1 ) {
23.               print(        sprintf( quot;%-*squot;, $pad_len, $objProp->Name ) . quot;: quot;
24.                           . $objProp->Value . quot;nquot; );
25.           }
26.       }
27.     print quot;nquot;;
28.   }
29.   $objWMI->DESTROY;
30.   $objWMI = quot;Unknownquot;;
31.   $objWMI = undef;
WMI Practical: ‘Enumerate WMI object’
WMI Class               :   win32_bios
Name                    :   Phoenix ROM BIOS PLUS Version 1.10 A07
BiosCharacteristics     :
BIOSVersion             :
BuildNumber             :   NULL
Caption                 :   Phoenix ROM BIOS PLUS Version 1.10 A07
CodeSet                 :   NULL
CurrentLanguage         :   en|US|iso8859-1
Description             :   Phoenix ROM BIOS PLUS Version 1.10 A07
IdentificationCode      :   NULL
InstallableLanguages    :   1
InstallDate             :   NULL
LanguageEdition         :   NULL
ListOfLanguages         :
Manufacturer            :   Dell Inc.
Name                    :   Phoenix ROM BIOS PLUS Version 1.10 A07
OtherTargetOS           :   NULL
PrimaryBIOS             :   1
ReleaseDate             :   20070402000000.000000+000
SerialNumber            :   MySerialNbr
SMBIOSBIOSVersion       :   A07
SMBIOSMajorVersion      :   2
SMBIOSMinorVersion      :   4
SMBIOSPresent           :   1
SoftwareElementID       :   Phoenix ROM BIOS PLUS Version 1.10 A07
SoftwareElementState    :   3
Status                  :   OK
TargetOperatingSystem   :   NULL
Version                 :   DELL   - 27d70402
WMI Practical: ‘Generate XML Dumps’
1.    use Win32::OLE qw(in);
2.    use strict;
3.    print(   quot;nquot;
4.           . ( '=' x 78 ) . quot;nquot;
5.           . quot;The following script shows how to obtain an XML representation ofnquot;
6.           . quot;the Win32_Bios class definition.nquot;
7.           . ( '=' x 78 ) . quot;nquot; );
8.    my $objWMI = Win32::OLE->GetObject(quot;winmgmts:win32_biosquot;);
9.    my $XMLDtd = 1;
10.   my $Text    = $objWMI->GetText_($XMLDtd);
11.   print( join( quot;n<PROPERTYquot;, split( /<PROPERTY/, $Text ) ) . quot;nquot; );
12.   $objWMI->DESTROY;
13.   $objWMI = quot;Unknownquot;;
14.   $objWMI = undef;
15.   #-----------------------------------------------------------------------------
16.   print(   ( '=' x 78 ) . quot;nquot;
17.          . quot;By specifying a particular instance of Win32_Bios, you cannquot;
18.          . quot;obtain that object's data.nquot;
19.          . ( '=' x 78 ) . quot;nquot; );
20.   my $strWMIClass = quot;win32_biosquot;;
21.   my $objWMI       = Win32::OLE->GetObject(quot;WinMgmts:quot;)->InstancesOf(quot;win32_biosquot;);
22.   print(   ( '-' x 78 ) . quot;nquot;
23.          . quot;Obtaining that object's data in XML.nquot;
24.          . ( '-' x 78 )
25.          . quot;nquot; );
26.   foreach my $objItem ( in $objWMI) {
27.       my $XMLDtd = 1;
28.       my $Text    = $objItem->GetText_($XMLDtd);
29.       print( join( quot;n<PROPERTYquot;, split( /<PROPERTY/, $Text ) ) . quot;nquot; );
30.   }
WMI Practical: ‘Generate XML Dumps’
<CLASS NAME=quot;Win32_BIOSquot; SUPERCLASS=quot;CIM_BIOSElementquot;>
<PROPERTY NAME=quot;__PATHquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>MyMachineNameROOTcimv2:Win32_BIOS</VALUE></PROPERTY>
<PROPERTY NAME=quot;__NAMESPACEquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>ROOTcimv2</VALUE></PROPERTY>
<PROPERTY NAME=quot;__SERVERquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>MyMachineName</VALUE></PROPERTY>
<PROPERTY.ARRAY NAME=quot;__DERIVATIONquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE.ARRAY><VALUE>CIM_BIOSElement</VALUE><VALUE>CIM_SoftwareElement</VA
    LUE><VALUE>CIM_LogicalElement</VALUE><VALUE>CIM_ManagedSystemElement</VALUE></VALUE.ARR
    AY></PROPERTY.ARRAY>
<PROPERTY NAME=quot;__PROPERTY_COUNTquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;sint32quot;><VALUE>27</VALUE></PROPERTY>
<PROPERTY NAME=quot;__RELPATHquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>Win32_BIOS</VALUE></PROPERTY>
<PROPERTY NAME=quot;__DYNASTYquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>CIM_ManagedSystemElement</VALUE></PROPERTY>
<PROPERTY NAME=quot;__SUPERCLASSquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>CIM_BIOSElement</VALUE></PROPERTY>
<PROPERTY NAME=quot;__CLASSquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>Win32_BIOS</VALUE></PROPERTY>
<PROPERTY NAME=quot;__GENUSquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;sint32quot;><VALUE>1</VALUE></PROPERTY>
<PROPERTY.ARRAY NAME=quot;BiosCharacteristicsquot; CLASSORIGIN=quot;Win32_BIOSquot;
    TYPE=quot;uint16quot;></PROPERTY.ARRAY>
<PROPERTY.ARRAY NAME=quot;BIOSVersionquot; CLASSORIGIN=quot;Win32_BIOSquot;
    TYPE=quot;stringquot;></PROPERTY.ARRAY>
<PROPERTY NAME=quot;BuildNumberquot; CLASSORIGIN=quot;CIM_SoftwareElementquot; PROPAGATED=quot;truequot;
    TYPE=quot;stringquot;></PROPERTY>
<PROPERTY NAME=quot;Captionquot; CLASSORIGIN=quot;CIM_ManagedSystemElementquot; PROPAGATED=quot;truequot;
    TYPE=quot;stringquot;></PROPERTY>
..
TYPE=quot;stringquot;></PROPERTY></CLASS>
WMI Practical: ‘Generate XML Dumps’
<INSTANCE CLASSNAME=quot;Win32_BIOSquot;>
<PROPERTY NAME=quot;__PATHquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>MyMachineNamerootcimv2:Win32_BIOS.Name=quot;Phoenix ROM BIOS PLUS
    Version 1.10 A07quot;,SoftwareElementID=quot;Phoenix ROM BIOS PLUS Version 1.10
    A07quot;,SoftwareElementState=3,TargetOperatingSystem=0,Version=quot;DELL   -
    27d70402quot;</VALUE></PROPERTY>
<PROPERTY NAME=quot;__NAMESPACEquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>rootcimv2</VALUE></PROPERTY>
<PROPERTY NAME=quot;__SERVERquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>MyMachineName</VALUE></PROPERTY>
<PROPERTY.ARRAY NAME=quot;__DERIVATIONquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE.ARRAY><VALUE>CIM_BIOSElement</VALUE><VALUE>CIM_SoftwareElement</VA
    LUE><VALUE>CIM_LogicalElement</VALUE><VALUE>CIM_ManagedSystemElement</VALUE></VALUE.ARR
    AY></PROPERTY.ARRAY>
<PROPERTY NAME=quot;__PROPERTY_COUNTquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;sint32quot;><VALUE>27</VALUE></PROPERTY>
<PROPERTY NAME=quot;__RELPATHquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>Win32_BIOS.Name=quot;Phoenix ROM BIOS PLUS Version 1.10
    A07quot;,SoftwareElementID=quot;Phoenix ROM BIOS PLUS Version 1.10
    A07quot;,SoftwareElementState=3,TargetOperatingSystem=0,Version=quot;DELL   -
    27d70402quot;</VALUE></PROPERTY>
<PROPERTY NAME=quot;__DYNASTYquot; CLASSORIGIN=quot;___SYSTEMquot;
    TYPE=quot;stringquot;><VALUE>CIM_ManagedSystemElement</VALUE></PROPERTY>
..
<PROPERTY NAME=quot;Versionquot; CLASSORIGIN=quot;CIM_SoftwareElementquot; TYPE=quot;stringquot;><VALUE>DELL   -
    27d70402</VALUE></PROPERTY></INSTANCE>
If ( !($WMI) )
•   Dos Executables
•   Perl XS interface to Win32 binaries
ddn123456@gmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019DevClub_lv
 
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando CoroutinesTDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutinestdc-globalcode
 
Bangun datar dan bangun ruang
Bangun datar dan bangun ruangBangun datar dan bangun ruang
Bangun datar dan bangun ruangSanSan Yagyoo
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017名辰 洪
 
Scalable Angular 2 Application Architecture
Scalable Angular 2 Application ArchitectureScalable Angular 2 Application Architecture
Scalable Angular 2 Application ArchitectureFDConf
 
Node.js and angular js
Node.js and angular jsNode.js and angular js
Node.js and angular jsHyungKuIm
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2Jeado Ko
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A RideBruce Snyder
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptjnewmanux
 
Hacking parse.y (RubyConf 2009)
Hacking parse.y (RubyConf 2009)Hacking parse.y (RubyConf 2009)
Hacking parse.y (RubyConf 2009)ujihisa
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overviewhesher
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기JeongHun Byeon
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJSKyung Yeol Kim
 

Was ist angesagt? (20)

Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019
 
dSS API by example
dSS API by exampledSS API by example
dSS API by example
 
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando CoroutinesTDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
 
Bangun datar dan bangun ruang
Bangun datar dan bangun ruangBangun datar dan bangun ruang
Bangun datar dan bangun ruang
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
OneRing @ OSCamp 2010
OneRing @ OSCamp 2010OneRing @ OSCamp 2010
OneRing @ OSCamp 2010
 
Scalable Angular 2 Application Architecture
Scalable Angular 2 Application ArchitectureScalable Angular 2 Application Architecture
Scalable Angular 2 Application Architecture
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
Node.js and angular js
Node.js and angular jsNode.js and angular js
Node.js and angular js
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2
 
Aimaf
AimafAimaf
Aimaf
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
 
Hacking parse.y (RubyConf 2009)
Hacking parse.y (RubyConf 2009)Hacking parse.y (RubyConf 2009)
Hacking parse.y (RubyConf 2009)
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJS
 

Ähnlich wie Win32 Perl Wmi

An introduction-to-windows-powershell-1193007253563204-3
An introduction-to-windows-powershell-1193007253563204-3An introduction-to-windows-powershell-1193007253563204-3
An introduction-to-windows-powershell-1193007253563204-3Louis Kolivas
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
WebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLSTWebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLSTenpit GmbH & Co. KG
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherMichele Orselli
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)Domenic Denicola
 
Real world cross-platform testing
Real world cross-platform testingReal world cross-platform testing
Real world cross-platform testingPeter Edwards
 
Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17Michele Orselli
 
Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Alexander Polce Leary
 
KDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics TutorialKDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics TutorialNeera Agarwal
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Samsung WebCL Prototype API
Samsung WebCL Prototype APISamsung WebCL Prototype API
Samsung WebCL Prototype APIRyo Jin
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionFelipe Prado
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSYevgeniy Brikman
 
Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski
Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski
Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski buildacloud
 
Doctrine with Symfony - SymfonyCon 2019
Doctrine with Symfony - SymfonyCon 2019Doctrine with Symfony - SymfonyCon 2019
Doctrine with Symfony - SymfonyCon 2019julien pauli
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmJameel Nabbo
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 
Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Ryan Weaver
 

Ähnlich wie Win32 Perl Wmi (20)

An introduction-to-windows-powershell-1193007253563204-3
An introduction-to-windows-powershell-1193007253563204-3An introduction-to-windows-powershell-1193007253563204-3
An introduction-to-windows-powershell-1193007253563204-3
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
WebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLSTWebLogic Administration und Deployment mit WLST
WebLogic Administration und Deployment mit WLST
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to another
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
Real world cross-platform testing
Real world cross-platform testingReal world cross-platform testing
Real world cross-platform testing
 
Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17
 
Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017
 
KDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics TutorialKDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics Tutorial
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Samsung WebCL Prototype API
Samsung WebCL Prototype APISamsung WebCL Prototype API
Samsung WebCL Prototype API
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski
Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski
Troubleshooting Strategies for CloudStack Installations by Kirk Kosinski
 
Doctrine with Symfony - SymfonyCon 2019
Doctrine with Symfony - SymfonyCon 2019Doctrine with Symfony - SymfonyCon 2019
Doctrine with Symfony - SymfonyCon 2019
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructure
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)
 

Kürzlich hochgeladen

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Kürzlich hochgeladen (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Win32 Perl Wmi

  • 2. WMI? • What Means It? • Who Made It? • What Makes It tick? • Where Might I use it for?
  • 3. Who Made It? • Set of Standards created by DMTF (Desktop Management Task Force Distributed Management Task Force)
  • 4. What Means It? • Set of Standards created by DMTF (Desktop Management Task Force Distributed Management Task Force) Consisting of: DMI (Desktop Management Interface) WBEM (Web-Based Entreprise Management) CIM (Common Interface Model) Bundled together known as Windows Meta Instrumentation.
  • 5. What Makes It tick? (1) Namespace(s) Provider Provider Class(es) Class(es) Class(es)
  • 6. What Makes It tick? (2) Namespace(s) Provider Provider Class(es) Class(es) Class(es) WMI Layer COM-API, SCRIPTING API OS Layer
  • 7. What Makes It tick? (3) Namespace(s) Provider Provider Class(es) Class(es) Class(es) WMI Layer COM-API, SCRIPTING API OS Layer WMI Classes, Objects & Properties COM-API, SCRIPTING-API, ... OS Specific Binaries, Registry, WBEM MIF & MOF Files, ... NT4 W2K W2K3 W2K8 XP Vista ...
  • 8. Where Might I use it for? A Quick & quot;Uniformquot; Development Interface Reporting Interface Device Management Interface
  • 9. Wow My…It even has a Wizard ;-) quot;Scriptomaticquot; • quot;A completely new version of the famous Scriptomatic, the utility that writes WMI scripts for you. (And, in the process, teaches you the fundamental concepts behind writing WMI scripts for yourself.) • Unlike its predecessor, Scriptomatic 2.0 isn’t limited to writing just VBScript scripts; instead, Scriptomatic 2.0 can write scripts in Perl, Python, or JScript as well. • In addition, Scriptomatic 2.0 gives you a host of new output formats to use when running scripts, including saving data as plain-text, as a stand-alone Web page, or even as XML. Scriptomatic 2.0 handles arrays, it converts dates to a more readable format, and it works with all the WMI classes on your computer; on top of all that, it also writes scripts that can be run against multiple machines.“* *Quote Microsoft Download Center Download: http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119- b7eb-783b0f7d1178&DisplayLang=en
  • 10. Example Perl WMI Query 1. use strict; 2. use Win32::OLE('in'); 3. use constant wbemFlagReturnImmediately => 0x10; 4. use constant wbemFlagForwardOnly => 0x20; 5. my @computers = (quot;.quot;); 6. foreach my $computer (@computers) { 7. my $objWMI = Win32::OLE->GetObject(quot;winmgmts:$computerrootCIMV2quot;) or die quot;WMI connection failed.nquot;; 8. my $colItems = $objWMI->ExecQuery(quot;SELECT * FROM Win32_NetworkAdapterquot;, quot;WQLquot;, 9. wbemFlagReturnImmediately | wbemFlagForwardOnly); 10. foreach my $objItem (in $colItems) { 11. print (quot;TimeOfLastReset: quot; 12. .UTCDate($objItem->{TimeOfLastReset}).quot;nquot;); 13. print quot;TimeOfLastReset: $objItem->{TimeOfLastReset}nquot;; 14. print quot;nquot;; 15. } 16. } 17. sub UTCDate(){ 18. my $WmiDate = qr/(d{4})(d{2})(d{2})(d{2})(d{2}) 19. (d{2}).(d{6})([+-])(.*)$ 20. /ox; 21. $_[0] =~ s/$WmiDate/$1 $2 $3 $4h $5m $6s (UTC$8$9m)/; 22. return $_[0]; 23. } 24. #TimeOfLastReset: 20071027003940.826905+120 25. #TimeOfLastReset: 2007 10 27 00h 39m 40s (UTC+120m)
  • 11. Connecting Perl to WMI (1) • Moniker 1. use Win32::OLE('in'); 2. use strict; 3. $strComputer = '.'; 4. $objWMI = Win32::OLE->GetObject('winmgmts:' . $strComputer . 'rootcimv2'); Constructing a Moniker String: http://msdn2.microsoft.com/en-us/library/aa389292.aspx
  • 12. Connecting Perl to WMI (2) • SWBEM Locator 1. use Win32::OLE('in'); 2. use strict; 3. my $objWMILocator = Win32::OLE->CreateObject(quot;WbemScripting.SWbemLocatorquot;); 4. $objWMILocator->Security_->{AuthenticationLevel} = 6; 5. my $objWMIComputer = $objWMILocator->ConnectServer($strComputer, quot;rootcimv2quot;, $strLocalUser, $strLocalPasswd); Connecting to WMI on a Remote Computer: http://msdn2.microsoft.com/en-us/library/aa389290.aspx
  • 13. WQL (SQL for WMI) AND NOT ASSOCIATORS OF NULL FALSE OR FROM REFERENCES OF GROUP Clause SELECT HAVING TRUE IS WHERE ISA WITHIN KEYSONLY __CLASS LIKE WQL (SQL for WMI): http://msdn2.microsoft.com/en-us/library/aa394606.aspx
  • 14. WQL - ExecQuery 1. my $objWMI = Win32::OLE->GetObject(quot;winmgmts:$computerrootCIMV2quot;) or die quot;WMI connection failed.nquot;; 2. my $colItems = $objWMI->ExecQuery(quot;SELECT * FROM Win32_NetworkAdapter“, quot;WQLquot;, wbemFlagReturnImmediately | wbemFlagForwardOnly); 3. foreach my $objItem (in $colItems) { 4. print ( quot;TimeOfLastReset: quot; 5. . UTCDate($objItem->{TimeOfLastReset}).quot;nquot;); 6. print quot;TimeOfLastReset: $objItem->{TimeOfLastReset} nnquot;; 7. } Calling a Method: http://msdn2.microsoft.com/en-us/library/aa384832.aspx WbemFlagEnum: http://msdn2.microsoft.com/en-us/library/Aa393980.aspx
  • 15. Example Perl WQL ‘Associators Of’ 1. use win32::ole; 2. use strict; 3. my $objWMI = Win32::OLE->GetObject('winmgmts:.rootcimv2') or die quot;WMI connection failed.nquot;; 4. my $colNAs = $objWMI->ExecQuery( 'select * ' . ' from Win32_NetworkAdapter' ); 5. foreach my $objNA( in $colNAs) { 6. my $colSubNAConfig = 7. $objWMI->ExecQuery( 'ASSOCIATORS OF {Win32_NetworkAdapter.DeviceID='' 8. . $objNA->DeviceID . ''} ' 9. . ' WHERE resultClass = ' 10. . ' win32_NetworkAdapterConfiguration' ); 11. foreach my $objNAConfig ( in $colSubNAConfig ) { 12. if ( $objNAConfig->DHCPEnabled == 1 ) { 13. my $intReturnCode = $objNAConfig->RenewDHCPLease(); 14. if ( $intReturnCode == 0 ) { 15. print quot;Renewed IP Configuration for quot;.$objNA->Name ; 16. } 17. elsif ( $intReturnCode == 1 ) { 18. print quot;You must reboot to renew the IP Configuration for quot; 19. .$objNA->Name ; 20. } 21. } 22. } 23. }
  • 16. WMI UTC Date/Time (1) Based on the CIM datetime/interval format Formatting: yyyymmddHHMMSS.mmmmmmsUUU or yyyy-mm-dd HH:MM:SS:mmm 1. foreach my $objItem (in $colItems) { 2. print (quot;TimeOfLastReset: quot; .UTCDate($objItem->{TimeOfLastReset}) 3. 4. .quot;nquot;); 5. print quot;TimeOfLastReset: $objItem->{TimeOfLastReset}nquot;; 6. print quot;nquot;; 7. } 8. } 9. #TimeOfLastReset: 20071027003940.826905+120 10. #TimeOfLastReset: 2007 10 27 00h 39m 40s (UTC+120m)
  • 17. WMI UTC Date/Time (2) Based on the CIM datetime/interval format Formatting: yyyymmddHHMMSS.mmmmmmsUUU or yyyy-mm-dd HH:MM:SS:mmm 1. sub UTCDate(){ 2. my $WMIDate = $_[0]; 3. $WMIDate =~ s/[^0-9-+]//gis; 4. my $WmiDateRaw = qr/(d{4})(d{2})(d{2}) 5. (d{2})(d{2})(d{2}) 6. (d{6})([+-])(.*)$ 7. /ox; 8. my $WmiDateFormatted = qr/(d{4})-?(d{2})-?(d{2}) 9. (d{2})(d{2})(d{2}) 10. (d{3})$ 11. /ox; 12. if ($WMIDate =~ s/$WmiDateRaw/$1 $2 $3 $4h $5m $6s (UTC$8$9m)/){ 13. return $WMIDate; 14. }; 15. if ($WMIDate =~ s/$WmiDateFormatted/$1 $2 $3 $4h $5m $6s/){ 16. return $WMIDate; 17. }; 18. } 19. #TimeOfLastReset: 20071027003940.826905+120 20. #TimeOfLastReset: 2007 10 27 00h 39m 40s (UTC+120m)
  • 18. WMI Practical: ‘Route Print’ 1. use strict; 2. use Win32::OLE('in'); 3. use constant wbemFlagReturnImmediately => 0x10; 4. use constant wbemFlagForwardOnly => 0x20; 5. my $objWMIService = Win32::OLE->GetObject(quot;winmgmts:localhostrootCIMV2quot;) 6. or die quot;WMI connection failed.nquot;; 7. my $colItems = $objWMIService->ExecQuery(quot;SELECT * FROM Win32_IP4RouteTablequot;, quot;WQLquot;, wbemFlagReturnImmediately | wbemFlagForwardOnly); 8. if (Win32::GetLastError()){ 9. # Do Error Handling. 10. }; 11. print quot;Destinationtquot;.quot;InterfaceIndextquot;.quot;Mask:tquot;.quot;Metric1:tquot;. quot;Name:tquot;.quot;NextHop:tquot;.quot;Type:tquot;.quot;Protocol:nquot;; 12. print ‘-’ x 78; 13. foreach my $objItem ( in $colItems) { 14. print quot;$objItem->{Destination}tquot;; 15. print sprintf quot;0x%xquot;, $objItem->{InterfaceIndex}.quot;tquot;; 16. print quot;$objItem->{Mask}t“.quot;$objItem->{Metric1}tquot;; 17. print quot;$objItem->{Name}t“.quot;$objItem->{NextHop}tquot;; 18. print quot;$objItem->{Type}t“.print quot;$objItem->{Protocol}nquot;; 19. }
  • 19. WMI Practical: ‘Route Add’ 1. use Win32::OLE; 2. use strict; 3. my $strComputer = '.'; 4. my $objLocator = Win32::OLE->new('WbemScripting.SWbemLocator'); 5. my $objWMI = $objLocator->ConnectServer($strComputer, 'root/CIMv2'); 6. my $objRoute = $objWMI->Get('Win32_IP4RouteTable')->SpawnInstance_(); 7. $objRoute->{Destination} = '0.0.0.0'; 8. $objRoute->{NextHop} = '10.10.0.1'; 9. $objRoute->{Mask} = '0.0.0.0'; 10. $objRoute->{InterfaceIndex} = 0x10006; 11. $objRoute->{Metric1} = 1; 12. $objRoute->{Protocol} = 1; 13. $objRoute->{Type} = 4; 14. $objRoute->Put_(); 15. if (Win32::GetLastError()){ 16. print quot;WMI Error: quot;.Win32::GetLastError().quot;nquot;; 17. $intReturnCode &= 0; 18. }; 19. #route add 0.0.0.0 MASK 0.0.0.0 10.10.0.1
  • 20. WMI Practical: ‘Route Delete’ 1. my $objWMI = Win32::OLE->GetObject('winmgmts:.rootcimv2'); 2. for ( my $j = 0; $j < $i; $j++ ) { 3. # open and delete local wmi instance 4. $objWMI->Delete( 'Win32_IP4RouteTable.Destination='‘ . $Destination . '',NextHop='‘ . $NextHop[$j] . ''' ); 5. if ( Win32::GetLastError() ) { 6. print quot;Could not delete the route gateway. quot; 7. . $NextHop[$j] 8. . quot;. WMI Error: quot; 9. . Win32::GetLastError() . quot;nquot;; 10. $intReturnCode &= 0; 11. } 12. else { 13. print quot;Route gateway quot; . $NextHop[$j] . quot; deletedquot; ; 14. $intReturnCode &= 1; 15. } 16. }
  • 21. WMI Practical: ‘Refreshing quot;PerfMon Dataquot;’ VBS PLS PL Accessing Performance Data : http://msdn2.microsoft.com/en-us/library/Aa384728.aspx
  • 22. WMI Practical: ‘Refreshing’ • VBS (`cscript script.vbs`) 1. ' Get the performance counter instance for the System process 2. set Perf = GetObject(quot;winmgmts:Win32_PerfFormattedData_PerfOS_Processor.name=‘0'quot;) 3. ' Display some properties in a loop 4. for I = 1 to 5 5. Wscript.Echo quot;Perf PercentIdleTime = quot; & Perf.PercentIdleTime 6. Wscript.Sleep 2000 7. ' Refresh the objects 8. Perf.Refresh_ 9. next C:>cscript Demo_Refresher.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Perf PercentIdleTime = 100 Perf PercentIdleTime = Perf PercentIdleTime = 100 Perf PercentIdleTime = 96 Perf PercentIdleTime = 96 C:>
  • 23. WMI Practical: ‘Refreshing’ • PLS (`cscript script.pls`) 1. use Win32::OLE qw(in); 2. use strict; 3. 4. my $Perf = Win32::OLE->GetObject( quot;winmgmts:Win32_PerfFormattedData_PerfOS_Processor.name=‘0'quot;); 5. for (my $i = 1;$i <= 5 ;$i++){ 6. sleep 5; 7. $Perf->Refresh_(); 8. print quot;PercentIdleTime: $Perf->{PercentIdleTime}nquot;; 9. } C:>cscript Demo_Refresher.pls Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Perf PercentIdleTime = 100 Perf PercentIdleTime = Perf PercentIdleTime = 96 Perf PercentIdleTime = 93 Perf PercentIdleTime = 97 C:>
  • 24. WMI Practical: ‘Refreshing’ • PL (`perl script.pl`) 1. use Win32::OLE qw(in); 2. use strict; 3. for (my $i = 1;$i <= 5 ;$i++){ 4. my $Perf = Win32::OLE->GetObject( quot;winmgmts:Win32_PerfFormattedData_PerfOS_Processor.name='0'quot;); 5. print quot;PercentIdleTime: $Perf->{PercentIdleTime}nquot;; 6. $Perf->DESTROY; 7. $Perf = quot;Unknownquot;; 8. $Perf = undef; 9. sleep 2; 10. }; C:>perl Demo_Refresher.pl PercentIdleTime: 96 PercentIdleTime: 93 PercentIdleTime: 100 PercentIdleTime: 96 PercentIdleTime: 96 C:>
  • 25. WMI Practical: ‘Data Dumping’ • WQL Query • Enumerate WMI object • Generate XML Dumps
  • 26. WMI Practical: ‘WQL Query’ • Cf. Slide ‘WQL – ExecQuery’
  • 27. WMI Practical: ‘Enumerate WMI object’ 1. my $strWMIClass = quot;win32_biosquot;; 2. my $objWMI = Win32::OLE->GetObject(quot;WinMgmts:quot;)->InstancesOf(quot;win32_biosquot;); 3. print( ( '-' x 78 ) . quot;n quot; 4. . quot;Obtaining that object's data in an enumerated way.nquot; 5. . ( '-' x 78 ) . quot;nquot; ); 6. my $pad_len = 30; 7. foreach my $objItem ( in $objWMI) { 8. print( sprintf( quot;%-*squot;, $pad_len, quot;WMI Classquot; ) . quot;: quot; 9. . $strWMIClass . quot;nquot; 10. . sprintf( quot;%-*squot;, $pad_len, quot;Name quot; ) . quot;: quot; 11. . sprintf( quot;%-*squot;, $pad_len, $objItem->Name ) . quot;nquot; ); 12. foreach my $objProp ( in $objItem->Properties_ ) { 13. if ( !( $objProp->Value ) ) { 14. print( sprintf( quot;%-*squot;, $pad_len, $objProp->Name ) . quot;: NULLnquot; ); 15. } 16. elsif ( $objProp->IsArray == 1 ) { 17. foreach my $i ($objProp) { 18. print( sprintf( quot;%-*squot;, $pad_len, $objProp->Name ) . quot;: quot; 19. . $objProp->Value($i) . quot;nquot; ); 20. } 21. } 22. elsif ( $objProp->IsArray != 1 ) { 23. print( sprintf( quot;%-*squot;, $pad_len, $objProp->Name ) . quot;: quot; 24. . $objProp->Value . quot;nquot; ); 25. } 26. } 27. print quot;nquot;; 28. } 29. $objWMI->DESTROY; 30. $objWMI = quot;Unknownquot;; 31. $objWMI = undef;
  • 28. WMI Practical: ‘Enumerate WMI object’ WMI Class : win32_bios Name : Phoenix ROM BIOS PLUS Version 1.10 A07 BiosCharacteristics : BIOSVersion : BuildNumber : NULL Caption : Phoenix ROM BIOS PLUS Version 1.10 A07 CodeSet : NULL CurrentLanguage : en|US|iso8859-1 Description : Phoenix ROM BIOS PLUS Version 1.10 A07 IdentificationCode : NULL InstallableLanguages : 1 InstallDate : NULL LanguageEdition : NULL ListOfLanguages : Manufacturer : Dell Inc. Name : Phoenix ROM BIOS PLUS Version 1.10 A07 OtherTargetOS : NULL PrimaryBIOS : 1 ReleaseDate : 20070402000000.000000+000 SerialNumber : MySerialNbr SMBIOSBIOSVersion : A07 SMBIOSMajorVersion : 2 SMBIOSMinorVersion : 4 SMBIOSPresent : 1 SoftwareElementID : Phoenix ROM BIOS PLUS Version 1.10 A07 SoftwareElementState : 3 Status : OK TargetOperatingSystem : NULL Version : DELL - 27d70402
  • 29. WMI Practical: ‘Generate XML Dumps’ 1. use Win32::OLE qw(in); 2. use strict; 3. print( quot;nquot; 4. . ( '=' x 78 ) . quot;nquot; 5. . quot;The following script shows how to obtain an XML representation ofnquot; 6. . quot;the Win32_Bios class definition.nquot; 7. . ( '=' x 78 ) . quot;nquot; ); 8. my $objWMI = Win32::OLE->GetObject(quot;winmgmts:win32_biosquot;); 9. my $XMLDtd = 1; 10. my $Text = $objWMI->GetText_($XMLDtd); 11. print( join( quot;n<PROPERTYquot;, split( /<PROPERTY/, $Text ) ) . quot;nquot; ); 12. $objWMI->DESTROY; 13. $objWMI = quot;Unknownquot;; 14. $objWMI = undef; 15. #----------------------------------------------------------------------------- 16. print( ( '=' x 78 ) . quot;nquot; 17. . quot;By specifying a particular instance of Win32_Bios, you cannquot; 18. . quot;obtain that object's data.nquot; 19. . ( '=' x 78 ) . quot;nquot; ); 20. my $strWMIClass = quot;win32_biosquot;; 21. my $objWMI = Win32::OLE->GetObject(quot;WinMgmts:quot;)->InstancesOf(quot;win32_biosquot;); 22. print( ( '-' x 78 ) . quot;nquot; 23. . quot;Obtaining that object's data in XML.nquot; 24. . ( '-' x 78 ) 25. . quot;nquot; ); 26. foreach my $objItem ( in $objWMI) { 27. my $XMLDtd = 1; 28. my $Text = $objItem->GetText_($XMLDtd); 29. print( join( quot;n<PROPERTYquot;, split( /<PROPERTY/, $Text ) ) . quot;nquot; ); 30. }
  • 30. WMI Practical: ‘Generate XML Dumps’ <CLASS NAME=quot;Win32_BIOSquot; SUPERCLASS=quot;CIM_BIOSElementquot;> <PROPERTY NAME=quot;__PATHquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>MyMachineNameROOTcimv2:Win32_BIOS</VALUE></PROPERTY> <PROPERTY NAME=quot;__NAMESPACEquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>ROOTcimv2</VALUE></PROPERTY> <PROPERTY NAME=quot;__SERVERquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>MyMachineName</VALUE></PROPERTY> <PROPERTY.ARRAY NAME=quot;__DERIVATIONquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE.ARRAY><VALUE>CIM_BIOSElement</VALUE><VALUE>CIM_SoftwareElement</VA LUE><VALUE>CIM_LogicalElement</VALUE><VALUE>CIM_ManagedSystemElement</VALUE></VALUE.ARR AY></PROPERTY.ARRAY> <PROPERTY NAME=quot;__PROPERTY_COUNTquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;sint32quot;><VALUE>27</VALUE></PROPERTY> <PROPERTY NAME=quot;__RELPATHquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>Win32_BIOS</VALUE></PROPERTY> <PROPERTY NAME=quot;__DYNASTYquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>CIM_ManagedSystemElement</VALUE></PROPERTY> <PROPERTY NAME=quot;__SUPERCLASSquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>CIM_BIOSElement</VALUE></PROPERTY> <PROPERTY NAME=quot;__CLASSquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>Win32_BIOS</VALUE></PROPERTY> <PROPERTY NAME=quot;__GENUSquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;sint32quot;><VALUE>1</VALUE></PROPERTY> <PROPERTY.ARRAY NAME=quot;BiosCharacteristicsquot; CLASSORIGIN=quot;Win32_BIOSquot; TYPE=quot;uint16quot;></PROPERTY.ARRAY> <PROPERTY.ARRAY NAME=quot;BIOSVersionquot; CLASSORIGIN=quot;Win32_BIOSquot; TYPE=quot;stringquot;></PROPERTY.ARRAY> <PROPERTY NAME=quot;BuildNumberquot; CLASSORIGIN=quot;CIM_SoftwareElementquot; PROPAGATED=quot;truequot; TYPE=quot;stringquot;></PROPERTY> <PROPERTY NAME=quot;Captionquot; CLASSORIGIN=quot;CIM_ManagedSystemElementquot; PROPAGATED=quot;truequot; TYPE=quot;stringquot;></PROPERTY> .. TYPE=quot;stringquot;></PROPERTY></CLASS>
  • 31. WMI Practical: ‘Generate XML Dumps’ <INSTANCE CLASSNAME=quot;Win32_BIOSquot;> <PROPERTY NAME=quot;__PATHquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>MyMachineNamerootcimv2:Win32_BIOS.Name=quot;Phoenix ROM BIOS PLUS Version 1.10 A07quot;,SoftwareElementID=quot;Phoenix ROM BIOS PLUS Version 1.10 A07quot;,SoftwareElementState=3,TargetOperatingSystem=0,Version=quot;DELL - 27d70402quot;</VALUE></PROPERTY> <PROPERTY NAME=quot;__NAMESPACEquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>rootcimv2</VALUE></PROPERTY> <PROPERTY NAME=quot;__SERVERquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>MyMachineName</VALUE></PROPERTY> <PROPERTY.ARRAY NAME=quot;__DERIVATIONquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE.ARRAY><VALUE>CIM_BIOSElement</VALUE><VALUE>CIM_SoftwareElement</VA LUE><VALUE>CIM_LogicalElement</VALUE><VALUE>CIM_ManagedSystemElement</VALUE></VALUE.ARR AY></PROPERTY.ARRAY> <PROPERTY NAME=quot;__PROPERTY_COUNTquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;sint32quot;><VALUE>27</VALUE></PROPERTY> <PROPERTY NAME=quot;__RELPATHquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>Win32_BIOS.Name=quot;Phoenix ROM BIOS PLUS Version 1.10 A07quot;,SoftwareElementID=quot;Phoenix ROM BIOS PLUS Version 1.10 A07quot;,SoftwareElementState=3,TargetOperatingSystem=0,Version=quot;DELL - 27d70402quot;</VALUE></PROPERTY> <PROPERTY NAME=quot;__DYNASTYquot; CLASSORIGIN=quot;___SYSTEMquot; TYPE=quot;stringquot;><VALUE>CIM_ManagedSystemElement</VALUE></PROPERTY> .. <PROPERTY NAME=quot;Versionquot; CLASSORIGIN=quot;CIM_SoftwareElementquot; TYPE=quot;stringquot;><VALUE>DELL - 27d70402</VALUE></PROPERTY></INSTANCE>
  • 32. If ( !($WMI) ) • Dos Executables • Perl XS interface to Win32 binaries