Forcing PowerShell errors output in English on localized systems

You can change the pipeline thread’s CurrrentUICulture like so: [Threading.Thread]::CurrentThread.CurrentUICulture=”fr-FR”; Get-Help Get-Process I’m on an English system but before I executed the line above, I updated help like so: Update-Help -UICulture fr-FR With that, the Get-Help call above gave me French help on my English system. Note: if I put the call to Get-Help on … Read more

How do I use Format-Table without truncation of values?

The $FormatEnumerationLimit preference variable doesn’t apply here, because its purpose is to determine how many elements of a collection-valued property to display (e.g, $FormatEnumerationLimit = 2; [pscustomobject] @{ prop = 1, 2, 3 } prints (at most) 2 elements from .prop‘s value and hints at the existence of more with …; e.g., {1, 2…}). Instead, … Read more

Converting Custom Object arrays to String arrays in Powershell

This will give you what you want: $strArray = $ms | Foreach {“$($_.Option)$($_.Title)”} Select-Object is kind of like an SQL SELECT. It projects the selected properties onto a new object (pscustomobject in v1/v2 and Selected.<orignalTypeName> in V3). Your second approach doesn’t work, because $_.Option in a string will only “interpolate” the variable $_. It won’t … Read more

tech