Wednesday, August 24, 2011

Storing 'Get-counter' data

You can do this:

((get-counter -counter '\\rmfvpc\TCPv4\Connections Established').countersamples) | % {$_.CookedValue}

and this:

(get-counter -counter '\\rmfvpc\TCPv4\Connections Established').Readings | findstr ^[0-9]

and this:

(get-counter -counter '\\rmfvpc\TCPv4\Connections Established' -continuous -sampleinterval 2)

but you can't do this:

Monday, August 22, 2011

Some addendum on modules

If you add modules like  PSUserTools from Microsoft you receive some enhanced functionality. You also receive some well conceived script.  After you have imported your modules ('import-module'), you can use a function like that below to list all the exported commands:

function Global:get-module_exports {

$commands=(get-module $ModName).ExportedCommands
[Array[]]$list=(($commands).Values) | %{$_.Name} | Sort