<# .SYNOPSIS Set the registry keys or generate files that can be used to set registry keys to point services at the RMS connector. .DESCRIPTION This command is used to configure registry settings on machines with specific services to point those services at the RMS connector or to create RegEdit files that can be used on machines with these services to configure their registry. The command can also be used to generate a GPO script that can be used by an Active Direcotry adminsitrator to create a GPO that can be applied to a specific class of machines. .PARAMETER ConnectorUri Required. This is the URI that points at the connector service (e.g. "http://MyConnector") .PARAMETER CreateRegEditFiles Create a set of RegEdit (.reg) files that can be used on the appropriate machine to configure the registry to point its services at the RMS connector. .PARAMETER CreateGPOScript Create a PowerShell Script that can be used by an administrator to create a GPO that can be used with the Group Policy Editor to apply required registry settings to a class of machines. .PARAMETER SetExchange2010 Configure the registry settings on the current machine to point the 2010 Exchange service at the RMS connector for IRM protection. .PARAMETER SetExchange2013 Configure the registry settings on the current machine to point the 2013 Exchange service at the RMS connector for IRM protection. .PARAMETER SetExchange2016AndAbove Configure the registry settings on the current machine to point the 2016 or above Exchange service at the RMS connector for IRM protection. .PARAMETER SetSharePoint2010 Configure the registry settings on the current machine to point the 2010 Sharepoint service at the RMS connector for IRM protection. .PARAMETER SetSharePoint2013 Configure the registry settings on the current machine to point the 2013 Sharepoint service at the RMS connector for IRM protection. .PARAMETER SetFCI2012 Configure the registry settings on the current machine to point the File Server Resource Manager’s File Classification Infrastructure’s RMS protection capabilities in a Windows Server 2012 or Windows Server 2012 R2 file server to the RMS connector for IRM protection. .PARAMETER OutPath The directory location to output the registry files and/or the GPO generation script file. .EXAMPLE Update the registry on the local computer to point the Exchange 2010 IRM configuration to RMS connector. .\GenConnectorConfig.ps1 -ConnectorUri http://MyConnector -SetExchange2010 .EXAMPLE Generate all the possible RegEdit files that can be used to configure the registry of machines that have services that work with the RMS connector. .\GenConnectorConfig.ps1 -ConnectorUri http://MyConnector -CreateRegEditFiles .EXAMPLE Generate the CreateConnectorRedirectGPOs.ps1 file that can be used by an administrator to create all the GPOs that are needed to configure machines that have services that work with the RMS connector. Once created, you will need to link the GPOs and target them to the desired objects in Active directory (e.g. the Exchange and SharePoint servers you want to configure). .\GenConnectorConfig.ps1 -ConnectorUri http://MyConnector -CreateGPOScript #> Param( [Parameter(Mandatory=$true)] [string] $ConnectorUri, [Parameter(Mandatory=$false)] [Switch] $CreateRegEditFiles, [Parameter(Mandatory=$false)] [Switch] $CreateGPOScript, [Parameter(Mandatory=$false)] [Switch] $SetExchange2010, [Parameter(Mandatory=$false)] [Switch] $SetExchange2013, [Parameter(Mandatory=$false)] [Switch] $SetExchange2016AndAbove, [Parameter(Mandatory=$false)] [Switch] $SetSharePoint2010, [Parameter(Mandatory=$false)] [Switch] $SetSharePoint2013, [Parameter(Mandatory=$false)] [Switch] $SetFCI2012, [Parameter(Mandatory=$false)] [string] $OutPath ) ###### function CreateRegEditFile([string] $RegFilePath) { New-Item $RegFilePath -type file -Force | Out-Null Add-Content -Encoding Unicode -Path $RegFilePath -Value "Windows Registry Editor Version 5.00" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" } function WriteMSDRMLicensingRedirectionExchangev15([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V15\IRM\CertificationServerRedirection]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "`"$RmsoUri`"=`"$ConnectorUri`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V15\IRM\LicenseServerRedirection]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "`"$RmsoUri`"=`"$ConnectorUri`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" } function WriteMSDRMLicensingRedirectionExchangev14([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V14\IRM\CertificationServerRedirection]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "`"$RmsoUri`"=`"$ConnectorUri`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V14\IRM\LicenseServerRedirection]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "`"$RmsoUri`"=`"$ConnectorUri`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" } function WriteMSDRMServiceLocation([string] $RegFilePath, [string] $RootUri) { Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\Activation]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "@=`"$RootUri/_wmcs/certification`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\EnterprisePublishing]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "@=`"$RootUri/_wmcs/licensing`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" } function WriteMSIPCServiceLocation([string] $RegFilePath, [string] $RootUri) { Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\EnterpriseCertification]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "@=`"$RootUri/_wmcs/certification`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\EnterprisePublishing]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "@=`"$RootUri/_wmcs/licensing`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" } function WriteMSIPCLicensingRedirection([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { Add-Content -Encoding Unicode -Path $RegFilePath -Value "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\LicensingRedirection]" Add-Content -Encoding Unicode -Path $RegFilePath -Value "`"$RmsoUri/_wmcs/licensing`"=`"$ConnectorUri/_wmcs/licensing`"" Add-Content -Encoding Unicode -Path $RegFilePath -Value "" } function WriteExchange2016AndAboveRegFile([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { CreateRegEditFile $RegFilePath WriteMSDRMServiceLocation $RegFilePath $RmsoUri WriteMSDRMLicensingRedirectionExchangev15 $RegFilePath $ConnectorUri $RmsoUri WriteMSIPCServiceLocation $RegFilePath $ConnectorUri WriteMSIPCLicensingRedirection $RegFilePath $ConnectorUri $RmsoUri } function WriteExchange2013RegFile([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { CreateRegEditFile $RegFilePath WriteMSDRMServiceLocation $RegFilePath $RmsoUri WriteMSDRMLicensingRedirectionExchangev15 $RegFilePath $ConnectorUri $RmsoUri } function WriteExchange2010RegFile([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { CreateRegEditFile $RegFilePath WriteMSDRMServiceLocation $RegFilePath $RmsoUri WriteMSDRMLicensingRedirectionExchangev14 $RegFilePath $ConnectorUri $RmsoUri } function WriteSharePoint2013RegFile([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { CreateRegEditFile $RegFilePath WriteMSIPCServiceLocation $RegFilePath $ConnectorUri WriteMSIPCLicensingRedirection $RegFilePath $ConnectorUri $RmsoUri } function WriteSharePoint2010RegFile([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { CreateRegEditFile $RegFilePath WriteMSDRMServiceLocation $RegFilePath $ConnectorUri } function WriteFCI2012RegFile([string] $RegFilePath, [string] $ConnectorUri, [string] $RmsoUri) { CreateRegEditFile $RegFilePath WriteMSDRMServiceLocation $RegFilePath $ConnectorUri } function WriteGPOScript([string] $GpoScriptFilePath, [string] $ConnectorUri, [string] $RmsoUri) { New-Item $GpoScriptFilePath -type file -Force | Out-Null Add-Content -Path $GpoScriptFilePath -Value "Import-Module GroupPolicy" Add-Content -Path $GpoScriptFilePath -Value "New-GPO -Name `"AAD RM Connector activation settings for FCI2012`" -Comment `"This GPO was created through a script built by the AAD RM Connector to enable the configuration of activation settings needed for IRM functionality through AAD RM in the registry of servers running the File Classification Infrastructure on Windows Server 2012`"" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector activation settings for FCI2012`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\Activation`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector activation settings for FCI2012`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "" Add-Content -Path $GpoScriptFilePath -Value "New-GPO -Name `"AAD RM Connector activation settings for SharePoint 2013`" -Comment `"This GPO was created through a script built by the AAD RM Connector to enable the configuration of activation settings needed for IRM functionality through AAD RM in the registry of servers running SharePoint 2013`"" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector activation settings for SharePoint 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\EnterpriseCertification`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector activation settings for SharePoint 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector activation settings for SharePoint 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\LicensingRedirection`" -ValueName `"$RmsoUri/_wmcs/licensing`" -Value `"$ConnectorUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "" Add-Content -Path $GpoScriptFilePath -Value "New-GPO -Name `"AAD RM Connector redirection settings for SharePoint 2010`" -Comment `"This GPO was created through a script built by the AAD RM Connector to enable the configuration of redirection settings needed for IRM functionality through AAD RM in the registry of servers running SharePoint 2010`"" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for SharePoint 2010`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\Activation`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for SharePoint 2010`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "" Add-Content -Path $GpoScriptFilePath -Value "New-GPO -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Comment `"This GPO was created through a script built by the AAD RM Connector to enable the configuration of redirection settings needed for IRM functionality through AAD RM in the registry of servers running Exchange 2016 or above`"" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\Activation`" -ValueName `"(default)`" -Value `"$RmsoUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$RmsoUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V15\IRM\LicenseServerRedirection`" -ValueName `"$RmsoUri`" -Value `"$ConnectorUri`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V15\IRM\CertificationServerRedirection`" -ValueName `"$RmsoUri`" -Value `"$ConnectorUri`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\EnterpriseCertification`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$ConnectorUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2016 and above`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSIPC\ServiceLocation\LicensingRedirection`" -ValueName `"$RmsoUri/_wmcs/licensing`" -Value `"$ConnectorUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "" Add-Content -Path $GpoScriptFilePath -Value "New-GPO -Name `"AAD RM Connector redirection settings for Exchange 2013`" -Comment `"This GPO was created through a script built by the AAD RM Connector to enable the configuration of redirection settings needed for IRM functionality through AAD RM in the registry of servers running Exchange 2013`"" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\Activation`" -ValueName `"(default)`" -Value `"$RmsoUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$RmsoUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V15\IRM\LicenseServerRedirection`" -ValueName `"$RmsoUri`" -Value `"$ConnectorUri`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2013`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V15\IRM\CertificationServerRedirection`" -ValueName `"$RmsoUri`" -Value `"$ConnectorUri`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "" Add-Content -Path $GpoScriptFilePath -Value "New-GPO -Name `"AAD RM Connector redirection settings for Exchange 2010`" -Comment `"This GPO was created through a script built by the AAD RM Connector to enable the configuration of redirection settings needed for IRM functionality through AAD RM in the registry of servers running Exchange 2010`"" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2010`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\Activation`" -ValueName `"(default)`" -Value `"$RmsoUri/_wmcs/certification`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2010`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDRM\ServiceLocation\EnterprisePublishing`" -ValueName `"(default)`" -Value `"$RmsoUri/_wmcs/licensing`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2010`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V14\IRM\LicenseServerRedirection`" -ValueName `"$RmsoUri`" -Value `"$ConnectorUri`" -Type String -Additive" Add-Content -Path $GpoScriptFilePath -Value "Set-GPRegistryValue -Name `"AAD RM Connector redirection settings for Exchange 2010`" -Key `"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\V14\IRM\CertificationServerRedirection`" -ValueName `"$RmsoUri`" -Value `"$ConnectorUri`" -Type String -Additive" } function RegisterAndRemoveFile([string] $RegFilePath) { # Start the RegEdit process and elevate privileges if necessary. # $job = Start-Process -FilePath "RegEdit.exe" -ArgumentList "-s `"$RegFilePath`"" -Verb RunAs -PassThru # Cannot use Wait-Job since if the process is launched as elevated from non-elevated window Wait-Job does not work. # while($job.HasExited -ne $true) { Start-Sleep -Milliseconds 500 } Remove-Item "$RegFilePath" } function AddSettingsPrompt() { do { $input = Read-Host "Install settings? [Y/N]" if ($input -ieq "Y") { return $true; } if ($input -ieq "N") { return $false; } } while ($true) } function VerifyMSDRMCryptoMode2Update() { $prompt = $false $value = (Get-Command "$env:windir\system32\msdrm.dll").FileVersionInfo.FileVersion $versions = $value.Split(" ")[0].Split(".") if ($versions.Length -ne 4) { Write-Host "The MSDRM version number does not appear to be valid. (Version: $value)" -ForegroundColor Red $prompt = $true } else { $version = [version]$value.Split(" ")[0] if ($version.Major-lt 6) { $prompt = $true } if (($version.Major -eq 6) -and ($version.Minor -eq 0) -and (($version.Build -lt 6002) -or (($version.Build -eq 6002) -and ($version.Revision -lt 22761)))) { $prompt = $true } if (($version.Major -eq 6) -and ($version.Minor -eq 1) -and (($version.Build -lt 7600) -or (($version.Build -eq 7600) -and ($version.Revision -lt 17000)))) { $prompt = $true } } if ($prompt) { Write-Host "The version of MSDRM on this machine does not support strong crypto. In most cases you will need a version of MSDRM that supports strong crypto in order to work with Windows Azure Rights Management through the RMS Connector. Please see the following support article for information about the Windows hotfix to support strong crypto: http://support.microsoft.com/kb/2627272" -ForegroundColor Yellow } return $prompt } function VerifyDependenciesFCI() { if (VerifyMSDRMCryptoMode2Update) { return AddSettingsPrompt } return $true } function VerifyDependenciesExchange2013() { $value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup" -ErrorAction SilentlyContinue).MsiProductMajor if (! $value) { Write-Host "Exchange 2013 does not appear to be installed on this machine." -ForegroundColor Red return AddSettingsPrompt } if (VerifyMSDRMCryptoMode2Update) { return AddSettingsPrompt } return $true } function VerifyDependenciesExchange2016AndAbove() { $value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup" -ErrorAction SilentlyContinue).MsiProductMajor if (! $value) { Write-Host "Exchange 2016 or above does not appear to be installed on this machine." -ForegroundColor Red return AddSettingsPrompt } if (VerifyMSDRMCryptoMode2Update) { return AddSettingsPrompt } return $true } function VerifyDependenciesExchange2010() { $value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v14\Setup" -ErrorAction SilentlyContinue).MsiProductMajor if (! $value) { Write-Host "Exchange 2010 does not appear to be installed on this machine." -ForegroundColor Red return AddSettingsPrompt } if (VerifyMSDRMCryptoMode2Update) { return AddSettingsPrompt } return $true } function VerifyDependenciesSharePoint2013() { $prompt = $false [string] $value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0" -ErrorAction SilentlyContinue).Version if (! $value) { Write-Host "SharePoint 2013 does not appear to be installed on this machine." -ForegroundColor Red $prompt = $true } $value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\MSIPC\CurrentVersion" -ErrorAction SilentlyContinue).'(default)' if (! $value) { Write-Host "MSIPC does not appear to be installed on this machine." -ForegroundColor Red $prompt = $true } else { $versions = $value.Split(".") if ($versions.Length -ne 4) { Write-Host "The MSIPC version number does not appear to be valid. (Version: $value)" -ForegroundColor Red $prompt = $true } else { $version = [version]$value if (($version.Major -lt 1) -or (($version.Major -eq 1) -and ($version.Minor -eq 0) -and ($version.Build -lt 622)) -or (($version.Major -eq 1) -and ($version.Minor -eq 0) -and ($version.Build -eq 622) -and ($version.Revision -lt 34))) { Write-Host "Please update the version of MSIPC on this machine, the minimum version required is 1.0.622.34. (Current Version: $value). The latest supported version can be found at http://www.microsoft.com/en-us/download/details.aspx?id=38396" -ForegroundColor Red $prompt = $true } } } if ($prompt) { return AddSettingsPrompt } return $true } function VerifyDependenciesSharePoint2010() { $value = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0" -ErrorAction SilentlyContinue).Version if (! $value) { Write-Host "SharePoint 2010 does not appear to be installed on this machine." -ForegroundColor Red return AddSettingsPrompt } if (VerifyMSDRMCryptoMode2Update) { return AddSettingsPrompt } return $true } #################################################################### # Main entry point for script if ($OutPath -eq "") { $OutPath = "." } if ($OutPath.EndsWith("\")) { $OutPath = $OutPath.Substring(0, $OutPath.Length - 1) } # Remove any extra "/" characters from the end of the Connector Uri if it exists. # if ($ConnectorUri.EndsWith("/")) { $ConnectorUri = $ConnectorUri.Substring(0, $ConnectorUri.Length - 1) } # Get the Rmso Uri from the connector service Url provided. # $WebClient = New-Object System.Net.WebClient $WebClient.UseDefaultCredentials = $true # Necessary because the site only allows Window Authenticated users to access it. $RmsoUri = $WebClient.DownloadString($ConnectorUri + "/_wmcs/GetRmsoUri.aspx") # Remove any extra "/" characters from the end of the RMSO Uri if it exists. # if ($RmsoUri.EndsWith("/")) { $RmsoUri = $RmsoUri.Substring(0, $RmsoUri.Length - 1) } # # if ($CreateRegEditFiles) { $Exchange2016AndAboveFileName = $OutPath + "\Exchange2016AndAboveRedirectionConfiguration.reg" WriteExchange2016AndAboveRegFile $Exchange2016AndAboveFileName $ConnectorUri $RmsoUri $Exchange2013FileName = $OutPath + "\Exchange2013RedirectionConfiguration.reg" WriteExchange2013RegFile $Exchange2013FileName $ConnectorUri $RmsoUri $Exchange2010FileName = $OutPath + "\Exchange2010RedirectionConfiguration.reg" WriteExchange2010RegFile $Exchange2010FileName $ConnectorUri $RmsoUri $SharePoint2013FileName = $OutPath + "\SharePoint2013RedirectionConfiguration.reg" WriteSharePoint2013RegFile $SharePoint2013FileName $ConnectorUri $RmsoUri $SharePoint2010FileName = $OutPath + "\SharePoint2010RedirectionConfiguration.reg" WriteSharePoint2010RegFile $SharePoint2010FileName $ConnectorUri $RmsoUri $FCI2012FileName = $OutPath + "\FCI2012RedirectionConfiguration.reg" WriteFCI2012RegFile $FCI2012FileName $ConnectorUri $RmsoUri } if ($CreateGPOScript) { $GPOScrioptFileName = $OutPath + "\CreateConnectorRedirectGPOs.ps1" WriteGPOScript $GPOScrioptFileName $ConnectorUri $RmsoUri } if ($SetExchange2016AndAbove) { if (VerifyDependenciesExchange2016AndAbove) { $RegFilePath = $env:TEMP + "\Exchange2016AndAboveRedirectionConfiguration.reg" WriteExchange2016AndAboveRegFile $RegFilePath $ConnectorUri $RmsoUri RegisterAndRemoveFile $RegFilePath } } if ($SetExchange2013) { if (VerifyDependenciesExchange2013) { $RegFilePath = $env:TEMP + "\Exchange2013RedirectionConfiguration.reg" WriteExchange2013RegFile $RegFilePath $ConnectorUri $RmsoUri RegisterAndRemoveFile $RegFilePath } } if ($SetExchange2010) { if (VerifyDependenciesExchange2010) { $RegFilePath = $env:TEMP + "\Exchange2010RedirectionConfiguration.reg" WriteExchange2010RegFile $RegFilePath $ConnectorUri $RmsoUri RegisterAndRemoveFile $RegFilePath } } if ($SetSharePoint2013) { if (VerifyDependenciesSharePoint2013) { $RegFilePath = $env:TEMP + "\SharePoint2013RedirectionConfiguration.reg" WriteSharePoint2013RegFile $RegFilePath $ConnectorUri $RmsoUri RegisterAndRemoveFile $RegFilePath } } if ($SetSharePoint2010) { if (VerifyDependenciesSharePoint2010) { $RegFilePath = $env:TEMP + "\SharePoint2010RedirectionConfiguration.reg" WriteSharePoint2010RegFile $RegFilePath $ConnectorUri $RmsoUri RegisterAndRemoveFile $RegFilePath } } if ($SetFCI2012) { if (VerifyDependenciesFCI) { $RegFilePath = $env:TEMP + "\FCI2012RedirectionConfiguration.reg" WriteFCI2012RegFile $RegFilePath $ConnectorUri $RmsoUri RegisterAndRemoveFile $RegFilePath } }