The problem is with the /D parameters in takeown.exe, that needs to be confirmed with language-independent yes/no start-letters (y/n in english, but ie j/n in danish).
This picture should clarify:
Changing the UI in the powershell-thread has no influence unfortunately. Heres the result of using wrong reply-letter (found later in this thread).
Using the english reply-letter Y in a Danish UI: "takeown.exe /A /R /D j /F C:\Test"gives the response:
takeown.exe : FEJL: Ugyldig syntaks. Værdien 'y'
er ikke tilladt for indstillingen '/D'.
In the opposite situation - using th Danish reply-letter J in an English UI: takeown.exe /A /R /D Y /F C:\Test gives the response: ERROR: Invalid syntax. 'j' value is not allowed for '/D' option.
Heres an experiment where I try to change UI, but still danish Takeown-settings rule:
$PGUICulture = 'en-us'
[System.Threading.Thread]::CurrentThread.CurrentCulture = 'en-us'
Invoke-Expression "takeown.exe /A /R /D Y /F C:\Test"
I've found out that there's a file called takeown.exe.mui under C:\Windows\System32\<language-id>. that I presume is relevant - but I don't know how I could handle this in my script..
Anyone knows how to nail that one?