How can I force dnscmd.exe to provide its output in English?
I have automation that parses the output of various dnscmd commands, such as dnscmd /info > dnsInfo.txt. I'm using PowerShell to execute those dnscmd commands, and I have no direct access to these servers (locally executed on my behalf by the server owner). 99% of the MS DNS servers that I encounter, regardless of their home country, are installed using the English edition. However, a handful are installed with a non-English edition, and it appears that dnscmd.exe uses different descriptive text fields when that scenario occurs. This breaks my parsing logic, and I'd love to avoid adding language specific regex each time.
For example, here are the first few words from running dnscmd /info on a non-English (Moroccan French) server:
Résultat de la requête :
Informations sur le serveur
nom du serveur
Alternatively, is there a way to instruct PowerShell to setup its environment under a different language? That might convince dnscmd.exe to change its output.
Update, This did not work:
function Set-Culture([System.Globalization.CultureInfo] $culture)
{
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
[System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
}
Set-Culture "en-US"
dnscmd.exe /info