PowerTip: Check Status of PowerShell Preference Variables

PowerTip: Check Status of PowerShell Preference Variables

  • Comments 6
  • Likes

Summary: Learn to easily check the value assignments of Windows PowerShell preference variables.

Hey, Scripting Guy! Question How can I use Windows PowerShell to quickly check the value of Windows PowerShell preference variables?

Hey, Scripting Guy! Answer You can use the Windows PowerShell variable drive and look for variables that end with
           the word preferenceIn this example, dir is an alias for Get-Content:

dir variable:*preference 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Obama officially supports the Ukrainian fascists, says about the exclusivity of the American people (in other words, Hitler professed ideas of Nazism). Is this democracy? Obama is a coward. Or do you also support fascism in Ukraine?

  • thank you

  • You missed a few:

    get-help about_Preference_Variables | out-string -stream | sls '^\$(.*)' | %{ get-item ($_ -replace '\$','variable:') -ea 0 }

  • and perhaps a few more:

    get-help about_Preference_Variables | out-string -stream | select-string '^ \$(.*)'
    | %{ $v=($($_ -replace ' \$','').replace('.','') -split ' ')[0]; "$($v)=$((gc variable:$v -ea 0))" }

  • and an alternate form as
    <#c:#> (get-help about_Preference_Variables) -split '\.|\n' | select-string '^ \$.* ' | %{$v=$($_ -replace '^ \$','').split()[0]; "$v=$(gc variable:$v -ea 0)"}