Use SharePointDSC to Install Language Packs

This article covers a demo I presented at the 2018 SharePoint Conference in Las Vegas. In the real world, clients will want to automate the process of installing new Language Packs onto their SharePoint Farms, especially if those farms contain a large number of servers. The present article presents you with a fully automated process to install language packs on all servers in your SharePoint Farm.

Scenario

Imagine that we are trying to go and install the Dutch and French language packs on a SharePoint 2016 Farm that has multiple servers. The first thing we need to do, is actually acquire the language packs from the web. Now, this scenario assumes the case where the servers in your farm have internet connectivity. If your servers are not connected to the internet, and language packs will be installed from a shared location, then you can ignore this section. To automatically download the Language Packs binaries from the web, we will be using the xDownloadFile DSC resource, which is available for grab on the PowerShell Gallery at: https://www.powershellgallery.com/packages/xDownloadFile/. This DSC resource simply downloads a file from the web and saves it locally on disk at the location specified, with a custom name that we provide for the files. The Dutch and French Language Packs for SharePoint 2016 can be found at the following location in order on the web:

For our example, we will be downloading the Language Packs under C:\LPs. We will be using a local admin account on all servers in the farm ($credsAdmin) to download the binaries. The DSC script block that we will be using to download both Language Packs is the following:

xDownloadFile DutchLanguagePack
{
    SourcePath               = "https://download.microsoft.com/download/0/1/E/01EE44A5-45FC-4FA5-9A97-BCDCDB483CC2/serverlanguagepack.exe"
    FileName                 = "serverlanguagepack-dutch.exe"
    DestinationDirectoryPath = "C:\LPs"
    PsDscRunAsCredential     = $credsAdmin
}

xDownloadFile FrenchLanguagePack
{
    SourcePath               = "https://download.microsoft.com/download/9/A/D/9ADBFA1E-C83D-4833-AD35-32970A981A83/serverlanguagepack.exe"
    FileName                 = "serverlanguagepack-french.exe"
    DestinationDirectoryPath = "C:\LPs"
    PsDscRunAsCredential     = $credsAdmin
}

Now that the binaries have been download on all servers in the farm, we need to extract their content, as specified in the SharePointDSC wiki. In our case, we will be extracting both Language Packs’ content into their own separate subfolders under our c:\LPs main folder. To do this, we will be using DSC scripts block as follow:

Script ExtractBinariesDutch
{
    GetScript = {
        @{
            GetScript = $GetScript
            SetScript = $SetScript
            TestScript = $TestScript
        }
    }
    SetScript = {
        C:\LPs\serverlanguagepack-dutch.exe /extract:C:\LPs\Dutch
        Start-Sleep 5			
    }
    TestScript = {
        Test-Path "C:\LPs\Dutch"    
    }
}

Script ExtractBinariesFrench
{
    GetScript = {
        @{
            GetScript = $GetScript
            SetScript = $SetScript
            TestScript = $TestScript
        }
    }
    SetScript = {
        C:\LPs\serverlanguagepack-french.exe /extract:C:\LPs\French
        Start-Sleep 5			
    }
    TestScript = {
        Test-Path "C:\LPs\French"    
    }
}

All that is now left, is to use the SPInstallLanguagePack DSC resource to install the binaries, and to run the SPConfigWizard resource to apply the bits onto the farm. The following line of PowerShell will take care of this:


SPInstallLanguagePack InstallLPBinariesDutch
{
    BinaryDir            = "C:\LPs\Dutch"
    Ensure               = "Present"
    PSDSCRunAsCredential = $credsSPSetup 
    DependsOn            = "[Script]ExtractBinariesDutch"
}

SPInstallLanguagePack InstallLPBinariesFrench
{
    BinaryDir            = "C:\LPs\French"
    Ensure               = "Present"
    PSDSCRunAsCredential = $credsSPSetup 
    DependsOn            = "[Script]ExtractBinariesFrench"
}

SPConfigWizard PSConfig
{
    Ensure               = "Present"
    PSDSCRunAsCredential = $credsSPSetup 
}

Make sure that all of the above DSC blocks are executed on all SharePoint servers in the farm, and you’ll have an automated multilingual farm in no time!

Leave a Reply

Your email address will not be published. Required fields are marked *