Windows 7 x64 property of a registry value

Hello,

I am using this script to detect differen Versions of which I want to delete.

The script is normaly working, but now I am having a problem on my Windows 7 x64 test Computer.

I want to catch the PSChild value of the current object but it is not work. I can't get any value.

((Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.Publisher -like  $vApplicationVendor+"*" -and $_.DisplayName -like  $vApplicationName+"*"}).PSChildName)

When I try it on another Computer with Windows 7 x64 then it is working.

Both computers are fully patched and havinf PS 2.0.

################################################
#Unsinstall Script                             #                            
#by Florian zepter                             #
#Version 1.0                                   #
################################################
#Edit here:                                    #  
#enter name and vendor (publisher) of the app  #
#Put the names into ''                         #                              
################################################
    
    $vApplicationName = 'Brava!' 
    $vApplicationVendor = 'IGC'
    #$vApplicationVersion = '11.0.0'
    
################################################
#no changes here!!!                            #
#Uninstall function                            #
################################################

#selection all the prducts where condition is suitable
# get the msi product codes
    $vApplictaionDetect = @(
                            ((Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.Publisher -like  $vApplicationVendor+"*" -and $_.DisplayName -like  $vApplicationName+"*"}).PSChildName)
                            ,
                            ((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.Publisher -like  $vApplicationVendor+"*"}).PSChildName)
                           )

    # remove software
    $vApplictaionDetect | ForEach-Object {if (!$_) {} else {Start-Process msiexec.exe -ArgumentList /x, $_, /qn -wait -passthru}}

September 1st, 2015 4:03am

Hi,

I am comparing two equal variables but I am always getting "FALSE" when I do a proof:

$vCondition1 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"{E95BCA9A-F9ED-48C7-AFB3-4053A0F1E02C}"

$vCondition2 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"{E95BCA9A-F9ED-48C7-AFB3-4053A0F1E02C}"

($vCondition1 -eq $vCondition2)

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 1:25pm

Hi,

I am comparing two equal variables but I am always getting "FALSE" when I do a proof:

$vCondition1 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"{E95BCA9A-F9ED-48C7-AFB3-4053A0F1E02C}"

$vCondition2 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"{E95BCA9A-F9ED-48C7-AFB3-4053A0F1E02C}"

($vCondition1 -eq $vCondition2)

September 8th, 2015 1:25pm

Those are objects. Test on the properties.
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 1:47pm

Like mike said something like this

$value1 = Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{012D26C3-E12A-3BDA-8ECE-DF14E721A507}'
$value2 = Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{012D26C3-E12A-3BDA-8ECE-DF14E721A507}'

if($value1.PSChildName -eq $value2.PSChildName)
{
    "Yes - The ID's are same!"
}
else
{
    "Nope - Match failed!"
}

In your code try like this

$vCondition1 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"{E95BCA9A-F9ED-48C7-AFB3-4053A0F1E02C}"

PS C:\> $vCondition1.GetType()

IsPublic IsSerial Name                                     BaseType                                                                                                
-------- -------- ----                                     --------                                                                                                
True     False    PSCustomObject                           System.Object    

September 8th, 2015 1:50pm

Hi your script is working, thanks for that.

But if I edit it for my script it does not work anymore:

$value1 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.Publisher -like "Lattice"+"*"}

$value2 = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.Publisher -like "Lattice"+"*"}

if($value1.PSChildName -eq $value2.PSChildName)

{

    "Yes - The ID's are same!"

}

else

{

    "Nope - Match failed!"

}

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 2:34pm

What is the actual point of this exercise?

Side note - why are you doing this: "Lattice"+"*"? Just do this 'Lattice*'

September 8th, 2015 2:41pm

What are you actually trying to do? (What is the purpose of the script?)

It looks like you are trying to determine if a software is installed or not.

If that's what you're really trying to do, there's no need to reinvent the wheel.

Windows IT Pro: Auditing 32-Bit and 64-Bit Applications with PowerShell

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 2:42pm

at the end i have to proof if a registry key exits or not. I will do this in a Loop. Once the key is not theit any more, i have to end the Setup process.
September 8th, 2015 2:43pm

What setup process? Why do you  need to do something in a loop?

Remember, we can't see your screen.

Tell what you want to do, not how you think you need to do it.

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 2:45pm

Ok I try to explain.

I am having a Software installed (Name XVL Player / Publisher Lattice) in a lot of different Versions.

On some Computers the software is installed a view times in different Versions.

The Problem is that the Software does not have a silent uninstall Option.

I grab the uninstall string and run it. once the Setup stands at the last window i have to Close that window.

to be sure that the uninstallation was successful i check if the registry still Exits.

if not, i stop the Setup process.

September 8th, 2015 2:50pm

at the end i have to proof if a registry key exits or not. I will do this in a Loop. Once the key is not theit any more, i have to end the Setup process.

So you're trying to do some sort of installation kludge?

Do yourself a favor and stop right now. Fix the installation issue instead of doing whatever you're trying to do.

Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 2:50pm

To check a registry key use "Test-Path hklm:\Software\....\keyname"

It is that easy.

September 8th, 2015 3:27pm

Hi Strahle,

Try to run it as admin.

also try it part by part if Get-ItemProperty is working

Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | ft pschildname

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 12:20am

At the end it was very easy :-) Thanks at all:

   

   

$vKey=((Get-ItemPropertyHKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*|Where-Object{$_.Publisher -like  $vApplicationVendor+"*"-and$_.DisplayName -like  "*"+$vApplicationName+"*"-and$_.UninstallString -like"*setup*"}).UninstallString) |Select-Object-First1


   

do


    {

   

Write-Host"loop"


   

Write-Host"$vKey"


    }

   

until(!(Test-PathHKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"$vkey"))

   

Write-Host"END"


   

   

   

Stop-Process-Namesetup


    }}

September 9th, 2015 9:32am

Great, you seem to have updated the code itself removing PSchildName.

How about closing this up, by marking some answers.

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 12:27am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics