In order to find an installed MSI file GUID in a remote VM - I'm using the following command inside of Invoke-Command
:
Get-WmiObject Win32_Product | Where-Object {$_.Name -eq "Application Name"}
This command shows in it's output an identifier number.
I know, I should add one more thing to this command in order to get only the GUID but I don't know how...
Now, I need to compare between this GUID to a GUID of a new MSI file I got for an installation.
This mean that:
if the GUID of the new file is older - I'll do nothing
if the GUID of the new file is equal - I'll do nothing
if the GUID of the new file is newer - I'll do an upgrade OR uninstall-install process...
So, In order to compare between the installed MSI's GUID and a new MSI file's GUID:
What will be the exact PowerShell command to find the GUID of the new MSI file?