If your SharePoint environment needs to cater for a global audience, chances are you’ll need to install a bunch of Language Packs. This can be tedious and time consuming, and frankly, I’m quite lazy. I’d much rather let a computer do the work…
After a quick Google, I found a couple of solutions that looked pretty good:
The first option seems as if it would work perfectly, but I’d rather not have another application sat clogging up my desktop. The second would also technically meet my requirements, however it’s a little too hardcoded, and would need me to update all the paths if / when a patch came out. To get the best of both worlds, I decided to create my own version of the script.
How it works
To get rid of the hardcoded URL’s, I’m using PowerShell v3’s Invoke-WebRequest. This allows me to scrape the HTML for the page, and find all of the available languages.
From here, it opens the language specific download page, and finds the “download” link. Specifically, the script gets the first link which ends in “.exe” or “.img”. It then uses Start-BitsTransfer, which kicks off the download of the file. It does this for each language. Once this is done, the script waits for all downloads to finish before finalizing them.
The PowerShell creates a new function called Get-SPLanguagePacks. It takes 2 parameters: The path, which is the location for all downloads to be saved to. The second parameter is the DownloadId. This is key to making the code reusable and less hardcoded. You can find this by going to the download page. It is the “id” parameter in the URL
Once you have this information, you can run the command like so:
#Download the SharePoint Server 2010 Service Pack 2 Language Packs
To run the commands, just ensure you have the powershell loaded up in your current session:
While none of the download links are hard coded, it does rely on a certain HTML structure on the Microsoft download centre. If the site gets a revamp, then the code is likely to stop working. This is a risk I’m willing to take, as it isn’t likely to update often, and should be a relatively minor change to the PowerShell if it does.
The code above will actually download ALL available language packs. Chances are, you’ll never need all of them. I figured because it’s happening automatically, I don’t mind having it download them all. It’s nice to have them ready in case I do need to install them. If you don’t want to bother downloading them all, you can easily add a Where-Object in before the Foreach-Object, and select the languages you do want to install, either by name, or country code.
Also, note really a limitation, but a note… this script is automatically downloading executable files from the internet. I feel that the Microsoft site is probably a trustworthy source, however you should probably understand the risks before running this in a production environment.
Once they’re downloaded, you’ll need to install the Language Packs. That’s beyond the scope of this blog, however carrying on the PowerShell should be easy. There are plenty of blog posts covering the next steps…