Hi
I'm looking to create a startup script that will only install a hotfix (calling msiexec.exe) if it isn't already installed. Can anyone help at all?
TIA
Hi
I'm looking to create a startup script that will only install a hotfix (calling msiexec.exe) if it isn't already installed. Can anyone help at all?
TIA
Last edited by randle; 20th October 2011 at 02:12 PM.
Did you ever find a way of doing this? If not I will post a script idea for you
I didn't as it goes. Maybe a little more detail would have been better. I was wanting to install an .msp to computers but doesn't look like WMI filtering can be used to specify when not already installed/present so decided on the script route however I have since simply deployed using a startup script and also updated my MDT images for future deployment. I was just trying to keep this tidy by having the script run only when the hotfix wasn't already installed!
I would still be interested for future possibilities though so would still be appreciated!
Code:REM --- install XXXX Hotfix ONLY if not already installed if exist "C:\Windows\-File or folder that is unique to this hotfix-" goto :eof ELSE @echo off \\servername\installfolder$\msiexec.exe /S
This may do it, you will need to compare two machines one without the hotfix and one with and find a folder or file that is ONLY installed on the drive after the hotfix is installed.
You may want to remember to remove the script after your done as another future hotfix may get overwritten.
Goodluck
randle (24th November 2011)
There is a registry key you could enumerate through to check if the hot fix is installed ( which is the same key sub keys where it shows what other software is installed ) I Presume this would also have all hot fixes listed
If its listed in here then ignore installation, if not then execute msiexec.exe to install the patch silently ?
How to manually remove programs from the Add or Remove Programs tool
Above ms kb indicates the reg key ( HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Uninstall )
http://forum.sysinternals.com/findin...opic21312.html
If this is the case regards to patches / hot fixes then you would enumerate all sub keys to find any that start with KB and a 6 digit number and find the KB for the hotfix you are trying to install and if it is there then ignore it , otherwise install it.From Chris128 on the above link :
Well through a bit of testing I just discovered how Add/Remove Programs decides whether an item under the Uninstall key is an update or a normal program if it doesnt have the ReleaseType or ParentKeyName value - it looks to see if the name of the subkey starts with KB and has 6 numbers after it! With all these GUIDs and other IDs being referenced all over the place I didnt think for a minute that they would be basing whether or not they show an item on something as simple as that! Also very unfortunate for anyone that creates a program that has an installer name of KB + 6 numbers![]()
I could still do with some help on why Microsoft Choice Guard shows up in my program but not in Add/Remove though
Last edited by mac_shinobi; 19th November 2011 at 04:07 AM.
randle (24th November 2011)

PowerShell example...
Edit. Just realised you meant the other sort of hotfix.Code:if (-Not (Get-HotFix -id KB2345678 -ErrorAction SilentlyContinue)) { Start-Process -FilePath "msiexec.exe" -WorkingDirectory "$env:SystemRoot\System32" -ArgumentList "/p X:\AdbeRdrUpd1011.msp REINSTALL=ALL REINSTALLMODE=omus /QN" -Wait -Passthru }
If you want to check to see if a registry key exists before installing a patch, you could try this...
Code:if (-Not ( Test-Path HKLM:\Software\Test )) { Start-Process -FilePath "msiexec.exe" -WorkingDirectory "$env:SystemRoot\System32" -ArgumentList "/p X:\AdbeRdrUpd1011.msp REINSTALL=ALL REINSTALLMODE=omus /QB!" -Wait -Passthru }
Last edited by Arthur; 19th November 2011 at 10:32 PM.
randle (24th November 2011)

WPKG is the tool for this sort of job - it has numerous checking if software installed type checks
Si
Thanks for all the help. I'll have a dabble.
@SimpleSi: I did have WPKG implemented at one point but for me GPO delivery was good enough and already there. I agree it would be good but not in this instance where I only have one hotfix to install in this way.
There are currently 1 users browsing this thread. (0 members and 1 guests)