

In turn, I can grab the string value of the properties I am interested in. Once I know the name of the subkey, then I can get its values. Writing an array of strings called sNames in Windows PowerShell. The $regcim object includes definitions of all the class methods. Let me quickly show you how to discover them. If you have been following the article series, then these will look familiar.

To query, we will use the EnumKey() method that requires a few parameters. $regcim = Get-CimClass -Namespace root\default -class StdRegProv -CimSession $cs We will be using the class’s methods directly. Remember, StdRegProv is not something with instances. Next we’ll create an object for StdRedProv using Get-CimClass. $rpath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"įor now I’m going to search the Uninstall key under HKLM. $cs = New-CimSession -ComputerName chi-win81 -Credential $credĮven though we will be using CIM, we are still accessing the same StdRegProv provider, so we still need to provide the appropriate hive values and paths. $cred = Get-Credential globomantics\administrator If you need to use alternate credentials, this is where you would do so. The first step is to create a CIM session to the remote computer. With CIM, we get an easy way to provide alternate credentials and also eliminate DCOM and RPC from the picture. Although you can get around that using PowerShell remoting and Invoke-Command, then you might as well use the CIM cmdlets. There is also no provision for alternate credentials like there is with the Get-WMIObject cmdlet.

Related: PowerShell Problem Solver: Searching the Registry to Find Installed Software.Related: PowerShell Problem Solver: Find Installed Software Using PowerShell.

One of the drawbacks is that this uses legacy technology and requires DCOM, which means it is not very firewall friendly. In the previous article in this series I demonstrated how to use WMI to query the registry on remote computers, where I specifically showed you how to use StdRegProv. Over the last several articles I’ve been guiding you on how to discover what applications might be installed.
