Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Retrieve CIM Methods

$
0
0

Summary: Learn how to use Windows PowerShell to retrieve CIM methods.

Hey, Scripting Guy! Question How can I use Windows PowerShell to dynamically obtain a list of CIM methods?

Hey, Scripting Guy! Answer Use the following script:

Clear-Host;

 

$ClassList = Get-CimClass;

 

foreach ($CimClass in $ClassList) {

    foreach ($CimMethod in $CimClass.CimClassMethods) {

        $Method = [PSCustomObject]@{

            Class = $CimClass.CimClassName;

            MethodName = $CimMethod.Name;

            Static = $false;

        };

        if ($CimMethod.Qualifiers.Name -contains 'static') {

            $Method.Static = $true;

        };

        $Method;

    }

}


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>