Searching for a String in Environmental Variables in Powershell

I've updated the post through feedback in the comments:
Regex compare on strings for Get-Variable is Where-Object -Match.

So, the closest parallel to the following bash code:

set | grep "Users"

is the following Powershell:

Get-Variable | Where-Object { $_.Value -Match "Users" }

or shortened:

gv | ? {$_.Value -Match "Users"}

Original Post, with Updates
I'm kind of dumbfounded how this:

Get-Variable | Select-String -Pattern "Users"

returns nothing.

Yet,

Get-Variable > gv.txt
Get-Content gv.txt | Select-String -Pattern "Users"

returns:

$                              Users
HOME                           C:UsersAdministrator
PWD                            C:UsersAdministrator

My initial thought was that maybe redirect captures standard output and standard error and the pipe doesn't, but then, standard error should all come to the screen unfiltered if not captured by the pipe.

Added:
To add insult to injury, apparently

Get-Variable -Include "PS*"

or just

Get-Variable "PS*"

will do a wildcard search for variable names.

Updated, per the comment from @jburger

Get-Variable | Where-Object { $_.Value -ne $null } | Where-Object {$_.ToString().Contains("Users") }

or

gv | ? { $_.Value -ne $null } | ? {$_.Value.ToString().Contains(“Users”) }

Playing with the Where-Object syntax, I was able to reduce this to:

Get-Variable | Where-Object { $_.Value -ne $null -and $_.ToString().Contains("Users") }

or

gv | ? { $_.Value -ne $null  -and $_.Value.ToString().Contains(“Users”) }

Definitely, this does the trick. However, I'm disappointed that PowerShell doesn't automatically cast the object output using a ToString() operation.

Finding the about screen in Word 2007

I had to dig to find this:

I used to be able to get the version number via the Help->About... functionality. Pretty standard Windows pattern.

I wanted to see if the pushed update of Office 2007 SP2 had been applied this morning, and eventually had to look it up.

It is now under the Office logo menu, which I expected. What I didn't expect is that it's buried under the Word Options selection at the bottom of that menu.

In the Word Options menu, go to the Resources tab/menu, and the last item in the right pane of that window is the standard "About" information.

Every time you make an Excel spreadsheet this big, a kitten meets its maker

I'm not really that elitist about non-programmers using applications in an advanced way the programmers could find a better way to do. I've never had to port functionality from an Excel spreadsheet that was 2 MB in size prior to data being added--at least not more than once.

However, I am a bit disturbed that Excel is the new Access:

The total number of available columns in Excel
Old Limit: 256 (2^8)
New Limit: 16k (2^14)

The total number of available rows in Excel
Old Limit: 64k (2^16)
New Limit: 1M (2^20)

Number of unique colours allowed a single workbook
Old Limit: 56 (indexed colour)
New Limit: 4.3 billion (32-bit colour)

Therefore, Excel is now Microsoft's new small business data warehouse. (Apologies to DW people.)

You could also store and represent a very large 32-bit color bitmap inside an Excel spreadsheet. Also supported are Base-64 Encoded BLOBs 🙂 :

The total number of characters that can display in a cell
Old Limit: 1k (when the text is formatted)
New Limit: 32k or as many as will fit in the cell (regardless of formatting)

The number of characters per cell that Excel can print
Old Limit: 1k
New Limit: 32k

I'd hate to have to debug a 8k character formula with 64 levels of nesting:

The maximum length of formulas (in characters)
Old Limit: 1k characters
New Limit: 8k characters

The number of levels of nesting that Excel allows in formulas
Old Limit: 7
New Limit: 64

A 255 argument function. The mind shudders. Even if you did not use a computer science major to create the program, such an unwieldly program might benefit from the education and experience of a computer science major. Maybe there is a better way to do this, by applying some mid-level software engineering techniques instead of stream of consciousness coding.

Maximum number of arguments to a function
Old Limit: 30
New Limit: 255

Autotext lines in Word (using 2003 here)

Sorry if this is pretty trivial for the true power users of Word...

I don't know if Word 2007 works this way or not, but I've discovered a couple additional characters in Word that auto-correct to divider lines. (Other than 'equals', 'minus', and 'underscore'). The 'hash' divider was of the most interest to me, as I'm trying to write a white paper and need distinctive, yet compact, format markings. (The quicker the better, as well.) Just enter 3 successive '#' (hash), '~' (tilde), '-' (minus sign), '=' (equals), '_' (underscore), or '*' (asterisk) characters and immediately press enter. The text will be replaced by a dividing line.

(This trick does something similar OpenOffice 2.4.)