Accessing Control Panel Server 2003

I am having trouble how to figure out how to access the items in the programs and features with powershell on server 2003. I currently have a script that will check if a specific application is installed under programs and then execute more commands after that, this is on server 2008.

$checkMSI = (Get-WmiObject -Query ‘SELECT * from win32_product where IdentifyingNumber = “{E876A5DA-9506-4F94-A304-E032CB53E970}”’).IdentifyingNumber

unfortunately the class “win32_product” is not available in server 2003.

Any help would be appreciated : ).

Win32_Product is a separate install in Win2003. You should find it on any Win2003 install DVD under the Support or Tools folder.

Ok, thank you very much. In my environment I have alot of servers that are in facilities out of state so I dont have immediate access to them to go ahead and install this addition to them, do you know of any other way to access the control panel in 2003? Or is this by far the easiest route.

I wouldn’t recommend using Win32_Product even if you had it available. See this blog post for the details on why: http://myitforum.com/cs2/blogs/gramsey/archive/2011/01/25/win32-product-is-evil.aspx

All of the information that you need to reproduce Win32_Product’s behavior (without the annoying side effects) can be found in the registry, mostly under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\ . This covers software that was installed with a Windows Installer package. Other, non MSI-based software can be found under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ . (There are some entries under the Uninstall key for MSI-based packages as well, but not with nearly as much detail as you’ll find under the Installer key.)

Maybe this function will help. It parses the registry keys Dave mentioned.
function Get-InstalledProgram{
<#
.SYNOPSIS
Gets the installed programs.

.DESCRIPTION
	This function queiries the registry for installed programs. 

.PARAMETER  DisplayName
	Optional filter. Name of the program. Suports wild cards.

.PARAMETER  Publisher
	Optional filter. Name of the appliication vendor. Supports wild cards.

.EXAMPLE
	Get-InstalledPrograms 

.EXAMPLE
	Get-InstalledPrograms -Publisher VMware* 

.EXAMPLE
	Get-InstalledPrograms | Out-GridView

.INPUTS
	System.String,System.String

.OUTPUTS
	PSOBject

.NOTES
	Created on:   8/10/2013 8:32 PM
    Created by:   David Christian

.LINK
	opscripting.com

#>

[CmdletBinding()]
param(
	[Parameter(Position=0)]
    [Alias('Name')]	
    [System.String] 
    $DisplayName,
  
    [Parameter(Position=1)]
    [Alias('Vendor')]
	[System.String]
	$Publisher
	)

#region Filter Prep
$WhereFilter = '![System.String]::IsNullOrEmpty($_.DisplayName)'
Write-Verbose -Message "Base Where filter: $WhereFilter"

If($DisplayName){
    $WhereFilter = '{0} -and ($_.DisplayName -like "{1}")' -f $WhereFilter,$DisplayName
    Write-Verbose -Message "Adding display filter: $WhereFilter"
}

If($Publisher){
    $WhereFilter = '{0} -and ($_.Publisher -like "{1}")' -f $WhereFilter,$Publisher
    Write-Verbose -Message "Adding publisher filter: $WhereFilter"
}

$whereBlock = [scriptblock]::Create($WhereFilter)
#endregion Filter Prep

#region Uninstall Registy Keys

$UNINSTALL_ROOT = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
$UNINSTALL_WOW = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$UNINSTALL_USER = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
$UNINSTALL_WOWUSER = "HKCU:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"

#endRegion Uninstall Registy Keys
    
$regPath = @{n='RegistryKey';E={$_.PSPath.Split('::')[-1]}}

[System.String[]]$RegKeys = $UNINSTALL_ROOT, $UNINSTALL_USER, $UNINSTALL_WOW, $UNINSTALL_WOWUSER

foreach ($key in $RegKeys) {
    if(Test-Path -Path $key){
        Write-Verbose -Message "Reading $key"
        
        $regKeyColumn = @{Name='RegistyKey';Expression={$key}}
        
        try{
        	Get-ItemProperty -Path $key  -Name *  -ErrorAction 'Stop'| 
                Where-Object $whereBlock | 
                Select-Object -Property DisplayName,
                                        DisplayVersion,
                                        Publisher,
                                        UninstallString,
                                        $regPath
		}
        Catch{
            Write-Warning -Message $_.Exception.Message
		}#end Catch
	}
}#end foreach key

}#end Get-InstalledProgram

Is this the easiest way that one would be able to determine if a program was installed using powershell?

Well It looks like with all your help and a little poking around on google, found the solution to my problem

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall* | Where-Object {$_.DisplayName -eq “Windows Installer PowerShell Module”}

Thanks for everyones help!