• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1345
  • Last Modified:

How to change Powershell script errors to english?

Hi

How can I change Powershell script errors from german to english?
Example:
Error
Thanks in advance
0
*** Hopeleonie ***
Asked:
*** Hopeleonie ***
2 Solutions
 
X_layerCommented:
I assume that you have German Windows.
Look this article and try.
0
 
footechCommented:
I don't know if there's any way to make this persistent, but what I found is if you have the language packs installed for the desired language, the following works.
With the display language set to English.
PS C:\> [Threading.Thread]::CurrentThread.CurrentUICulture = 'de'; gc jkdd.txt
Get-Content : Der Pfad "C:\jkdd.txt" kann nicht gefunden werden, da er nicht vorhanden ist.
Bei Zeile:1 Zeichen:62
+ [Threading.Thread]::CurrentThread.CurrentUICulture = 'de'; gc <<<<  jkdd.txt
    + CategoryInfo          : ObjectNotFound: (C:\jkdd.txt:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

PS C:\> gc jkdd.txt
Get-Content : Cannot find path 'C:\jkdd.txt' because it does not exist.
At line:1 char:3
+ gc <<<<  jkdd.txt
    + CategoryInfo          : ObjectNotFound: (C:\jkdd.txt:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Open in new window


With the display language set to Deutsch.
PS C:\> [Threading.Thread]::CurrentThread.CurrentUICulture = 'en-us'; gc jkdd.txt
Get-Content : Cannot find path 'C:\jkdd.txt' because it does not exist.
At line:1 char:65
+ [Threading.Thread]::CurrentThread.CurrentUICulture = 'en-us'; gc <<<<  jkdd.txt
    + CategoryInfo          : ObjectNotFound: (C:\jkdd.txt:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

PS C:\> gc jkdd.txt
Get-Content : Der Pfad "C:\jkdd.txt" kann nicht gefunden werden, da er nicht vorhanden ist.
Bei Zeile:1 Zeichen:3
+ gc <<<<  jkdd.txt
    + CategoryInfo          : ObjectNotFound: (C:\jkdd.txt:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Open in new window


That seems to only work when the command is on the same line as from what I've read it is reset for each pipeline.
0
 
*** Hopeleonie ***IT ManagerAuthor Commented:
Thanks so much.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now