Skip to content

Instantly share code, notes, and snippets.

@KentNordstrom
Created November 30, 2018 08:28
Show Gist options
  • Save KentNordstrom/47e457bcc5b49feb6e13c700d4277dc7 to your computer and use it in GitHub Desktop.
Save KentNordstrom/47e457bcc5b49feb6e13c700d4277dc7 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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
Copy link

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