seesharpconcepts
seesharpconcepts

Reputation: 190

Powershell command to get all the Language Packs installed on a server running windows server 2012

How do I find all the language packs that are installed on my server (windows server 2012) through powershell command? I like to identify(through script) if any of the languages that are required by my services are not installed and then run DISM to add missing language packages.

Upvotes: 2

Views: 34218

Answers (4)

Jeroen Grusewski
Jeroen Grusewski

Reputation: 31

Added Trim(), required for contains/ notcontains

$languagePacks = (dism /online /Get-Intl)  | 
   ?{ $_.Contains("Installed language(s):") } | 
    %{ $_.Split(":")[1].Trim() } 

if( $languagePacks -contains $language) {
  Write-host 'installed'
}

Upvotes: 3

beatcracker
beatcracker

Reputation: 6920

You can parse DISM output:

$LangPacks = DISM.exe /Online /Get-Intl /English |
    Select-String -SimpleMatch 'Installed language(s)'|
        ForEach-Object {
            if($_ -match ':\s*(.*)'){$Matches[1]}
        }

if($LangPacks -notcontains 'ru-Ru'){
    Write-Host 'Language pack not installed!'
}

Upvotes: 6

steoleary
steoleary

Reputation: 9298

You should be able to see this by querying WMI, the MUILanguages property in Win32_OperatingSystem I believe shows the installed languages:

$OSInfo = Get-WmiObject -Class Win32_OperatingSystem
$languagePacks = $OSInfo.MUILanguages
$languagePacks

Upvotes: 7

David Brabant
David Brabant

Reputation: 43539

(dism /online /Get-Intl)  | 
    ?{ $_.Contains("Installed language(s):") } | 
    %{ $_.Split(":")[1] }

Upvotes: 1

Related Questions