Right, this is what I have.. I understand why its not working but cant think of way round it or easier way to get to the point I want to be at..
I have script where I can check disk space and install on the local or remote machines.. this works fine.. But I've been advised to follow best practice I should incorporate something that checks where a version is already installed and install it if necessary..
Here's a similar representation of the piece of script -
$FileName = get-itemproperty 'C:\Powershell\Blah Blah Blah 1.1.1.1 Installer.msi' | Select name Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -like "$FileName"} | foreach-object -process {$_.Uninstall()}
It doesn't find the software installed to be able to install it.. I've checked..
But when I Type the following -
Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "Blah Blah Blah"} | foreach-object -process {$_.Uninstall()}
Basically the same as the top example without the '1.1.1.1 Installer.msi' part.. It has the expected result - It picks up the installed software and installs correctly..
Is there a way to get round this or an easier way to look to see if the software or previous versions are installed and if there is.. to uninstall them?
A friend of mine mentioned 'Uninstall Stings' but after research they confuse me a bit..
Any guidance or assistance is greatly appreciated..
Thanks Guys - Loving the PowerShell Community :)