aldrin
(-Aldrin-)
1
Sorry for putting this in Watercooler. I cant find the Programming group for some reason. Mods please feel free to move this post to where its appropriate. Thanks!
Scripting noob here,
I tried to uninstall a software using this script through GP:
MsiExec.exe /norestart /q/x{PRODUCT ID FROM REGISTRY KEY} REMOVE=ALL
This worked perfectly with x64 installs but didnt work with x86 installs because they have different product IDs.
Basically, what I want is for the script to find the x86 installs product ID then uninstall the software if it exists. If it doesnt find the x86 product ID then it uninstalls the x64 software.
This is what I have in mind:
@echo off
if exist {x86 PRODUCT ID}
MsiExec.exe /norestart /q/x{x86 PRODUCT ID} REMOVE=ALL
else
MsiExec.exe /norestart /q/x{x64 PRODUCT ID} REMOVE=ALL
Any suggestions?
Thanks!
5 Spice ups
You want to use Powershell! Seriously, my head spins with the extra abilities you have within Powershell vs command line.
For instance, here’s a Powershell command to return the information on an installed program queried by name
Get-WmiObject -Query "select * from win32_service where name='WinRM'"
And here’s a link to Microsoft Scripting Guy and how you can perform the whole uninstal; process with the same Powershell cmdlet.
Use Powershell to Find and Uninstall Software - Scripting Guy Blog
2 Spice ups
chamele0n
(Chamele0n)
3
You can still do this with group policy, but you would need 2 GPOs and use filtering. You would filter by CPU architecture for each GPO, and put the correct product ID in each GPO.
1 Spice up
aldrin
(-Aldrin-)
4
Yeah i’ve been thinking of doing a separate GPO but I thought it would be nice for me to do some scripting.
chamele0n
(Chamele0n)
5
Not saying you can’t or shouldn’t. I myself am an avid PowerShell lover, but there are times where a script isn’t necessary or even the best solution for the job.
3 Spice ups
aldrin
(-Aldrin-)
6
You’re right. I forgot to apply this acronym: K.I.S.S.