I need to delete all msi files in the windows installer folder with the author of crowdstrike
Remove-item -path c:\windows\installer I dont get how to target author or even digital signature
is there a way? -filter maybe
Thank you
I need to delete all msi files in the windows installer folder with the author of crowdstrike
Remove-item -path c:\windows\installer I dont get how to target author or even digital signature
is there a way? -filter maybe
Thank you
As far as I know there is no build in way to get the information you asked for from an MSI file. You might take a look at this link. It may help you How to get MSI file information with PowerShell
I just went with the *.msi option as it doesnt matter really if i keep any of the other MSI’s since its a bunch of VDI linkedclones
although if anyone knows of a way i would love to know for future reference.
Thank you
It’s ridiculously hard to work with the WindowsInstaller.Installer (msi) com object in powershell. I would call a vbscript from powershell or just use vbscript.
You could use the Shell.Application ComObject to read the .msi metadata.
cls $folder = "C:\windows\Installer\" $objShell = New-Object -ComObject Shell.Application $objFolder = $objShell.namespace($folder) $objFolder.Items() | Where-Object {$_.Name -like "*.msi"} | ForEach-Object { [pscustomobject]@{ $objFolder.getDetailsOf($folder, 0) = $objFolder.getDetailsOf($_, 0); $objFolder.getDetailsOf($folder, 20) = $objFolder.getDetailsOf($_, 20) $objFolder.getDetailsOf($folder, 185) = $objFolder.getDetailsOf($_, 185) } } | Where-Object {$_.Authors -eq "crowdstrike"} | ForEach-Object { $_ #Do something }
i tried to use the vb script and add a obj.deletefile at the end i keep getting
line 2
char 1
error invalid character
800A0408
microsoft vbscript compilation error
any ideas why its barking at me?
Here’s how I get the target of msi shortcuts. Call the vbscript and then store the result in a powershell variable:
$targetpath = cscript /nologo gettarget.vbs someshortcut.lnk
Where gettarget.vbs looks like:
Dim MSITarget Set Msi = CreateObject("WindowsInstaller.Installer") Set MSITarget = Msi.ShortcutTarget(wscript.arguments(0)) Wscript.Echo Msi.ComponentPath(MSITarget.StringData(1), MSITarget.StringData(3))
Hey Steve,
What VBScript are you referring to? What I provided was PowerShell, not VBScript.