Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install MIM 2016 Updates (Hotfix Rollups)
<#
.SYNOPSIS
Installs updates for MIM Synchronization Service and MIM Service.
.ToDo
Add support for Languagepack updates.
#>
PARAM(
[string]$Version = "4.5.286.0",
[string]$MediaFolder = "F:\Install\Media",
[string]$LogFolder = "F:\Install\Logs"
)
$FIMSynchronizationService = Get-Service -Name FIMSynchronizationService -ErrorAction SilentlyContinue
$FIMService = Get-Service -Name FIMService -ErrorAction SilentlyContinue
function Install{
PARAM([string]$MSP,[string]$LogFilePath)
$ArgumentList = "/p $MSP /L*v $LogFilePath"
$result=(Start-Process -FilePath "msiexec.exe" -ArgumentList $ArgumentList -Wait -PassThru).ExitCode
if($result -eq 0){
"Installing $MSP completed succesfully."
}
else{
"Some error occured, please check $LogFilePath"
}
return $result
}
if($FIMSynchronizationService){
#This is the FIM Sync Service Server
$FIMSynchronizationService | Stop-Service
$MIMPatch = Get-Item ($MediaFolder + "\" + $Version + "\" + "MIMSyncService*")
$LogFilePath = $LogFolder + "\" + "MIMSync" + $Version + ".log"
Install -MSP $MIMPatch.FullName -LogFilePath $LogFilePath
}
if($FIMService){
#This is the FIM Service Server
$FIMService | Stop-Service
$MIMPatch = Get-Item ($MediaFolder + "\" + $Version + "\" + "MIMService*")
$LogFilePath = $LogFolder + "\" + "MIMService" + $Version + ".log"
Install -MSP $MIMPatch.FullName -LogFilePath $LogFilePath
}
if(!$FIMSynchronizationService -and !$FIMService){
#This is only a Portal server
$MIMPatch = Get-Item ($MediaFolder + "\" + $Version + "\" + "MIMService*")
$LogFilePath = $LogFolder + "\" + "MIMService" + $Version + ".log"
Install -MSP $MIMPatch.FullName -LogFilePath $LogFilePath
}
@KentNordstrom

This comment has been minimized.

Copy link
Owner Author

KentNordstrom commented Nov 30, 2018

As you can see the script expects that the updates are downloaded to a folder named as the version, like F:\Install\Media\4.5.286.0.

@SuryenduB

This comment has been minimized.

Copy link

SuryenduB commented Feb 6, 2020

Thanks Kent . This is very simple and minimalistic, just the way I like my scriptsto be.
I

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.