If you are on PowerShell v2, it is MTA which means IIRC you can get a different thread for every pipeline invocation. V1, V3 and V4 are STA however, I believe PowerShell resets the culture at certain points in execution. I believe something like the following will work better:
function Using-Culture
{
param(
[Globalization.CultureInfo]$culture = (throw "USAGE: Using-Culture -Culture culture -Script {scriptblock}"),
[ScriptBlock]$script = (throw "USAGE: Using-Culture -Culture culture -Script {scriptblock}")
)
$OldCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture
$OldUICulture = [System.Threading.Thread]::CurrentThread.CurrentUICulture
try {
[System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
Invoke-Command $script
}
finally {
[System.Threading.Thread]::CurrentThread.CurrentCulture = $OldCulture
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $OldUICulture
}
}