Last active
December 16, 2018 18:43
-
-
Save KentNordstrom/a3c818665145a8604f8a7351030e9858 to your computer and use it in GitHub Desktop.
Script to install MIM Synchronization Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Installs MIM Synchronization Service | |
Expects the MIM ISO file to install from in the MediaFolder. | |
Script will ask for ServiceAccount password. | |
Typically the SQL Server is an SQL Alias | |
Please update the Parameters region to meet your own needs. | |
.ToDo | |
Update to work with gMSA as service account. | |
#> | |
PARAM( | |
[string]$ServiceDomain = "AD", | |
[string]$SQLServer = "dbFIMSync", | |
[string]$MediaFolder = "D:\Install\Media", | |
[string]$LogFolder = "D:\Install\Logs" | |
) | |
#region Parameters | |
$SERVICEACCOUNT = "svcFIMSync" | |
$GROUPADMINS = "$ServiceDomain\FIMSyncAdmins" | |
$GROUPOPERATORS = "$ServiceDomain\FIMSyncOperators" | |
$GROUPACCOUNTJOINERS = "$ServiceDomain\FIMSyncJoiners" | |
$GROUPBROWSE = "$ServiceDomain\FIMSyncBrowse" | |
$GROUPPASSWORDSET = "$ServiceDomain\FIMSyncPasswordSet" | |
$SQLDB = "FIMSynchronizationService" | |
$FIREWALL_CONF = "1" | |
#endregion Parameters | |
#region Load ISO | |
$ISO = (Get-ChildItem $MediaFolder | ?{$_.Name -like '*identity_manager*'}).FullName | |
if(!$ISO){ | |
"Unable to find Media. Exiting!" | |
"Press any key to abort!" | |
$x = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | |
Exit | |
} | |
else{ | |
$DriveLetter = (Mount-DiskImage -ImagePath $ISO -PassThru | Get-Volume).DriveLetter | |
} | |
#endregion Load ISO | |
#region Initiate | |
$SourcePath = "`"" + $DriveLetter + ":\Synchronization Service\Synchronization Service.msi`"" | |
$STORESERVER = $SQLServer | |
$SERVICEPASSWORD = (Get-Credential -Message $SERVICEACCOUNT -UserName $SERVICEACCOUNT).GetNetworkCredential().Password | |
$LogFilePath = "$LogFolder\FlowSyncInstallLog.txt" | |
#endregion Initiate | |
#region Installation | |
$ArgumentList = "/qb /i $SourcePath STORESERVER=$STORESERVER SQLDB=$SQLDB SERVICEACCOUNT=$SERVICEACCOUNT SERVICEPASSWORD=$SERVICEPASSWORD SERVICEDOMAIN=$ServiceDomain GROUPADMINS=$GROUPADMINS GROUPOPERATORS=$GROUPOPERATORS GROUPACCOUNTJOINERS=$GROUPACCOUNTJOINERS GROUPBROWSE=$GROUPBROWSE GROUPPASSWORDSET=$GROUPPASSWORDSET FIREWALL_CONF=$FIREWALL_CONF /L*v $LogFilePath" | |
$result=(Start-Process -FilePath "msiexec.exe" -ArgumentList $ArgumentList -Wait -PassThru).ExitCode | |
#endregion Installation | |
#region Result | |
if($result -eq 0){ | |
"Install completed succesfully." | |
} | |
else{ | |
"Some error occured, please check $LogFilePath" | |
} | |
#endregion Result | |
#region CleanUp | |
Dismount-DiskImage -ImagePath $ISO | |
#endregion CleanUp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment