INTRODUCTION

Setting a firewall exception is a simple job right? Well, it is, if you are running an English OS. As soon as the OS language is something else, the exception group will also change to that language. In the case of Swedish, the name will be “Fjärrskrivbord” instead of “Remote Desktop”. This might be tricky if you want to do this on a quite a few computers with different languages.

SOLUTION

One way of doing it is by writing a Powershell script:

Function FirewallException ($LanguageCode)
{
    switch ($LanguageCode)
    {
    1030 
    1033 {netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes}
    1053 {netsh advfirewall firewall set rule group="Fjärrstyrning" new enable=yes} 
    Default {netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes}
    }
}

function GetOSLanguage
{
   $OSLanguage = Get-WmiObject win32_operatingsystem | foreach {$_.oslanguage}
   $OSLanguage
}

FirewallException (GetOSLanguage)

An easier solution to this problem is using the rule group “@FirewallAPI.dll,-28752”, which is independent of the language installed.

This would mean you would put this in your script:

netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28752" new enable=yes

There are of course, many more ways of doing this, but these are two ways you can do it.