Wednesday, April 18, 2012

Updating the "Assigned numbers" Script

I was working with something quite different, when I came a cross a way to count the number of "hits" when using PowerShell. It was quite easy, and I have now updated the "assignednumbers.txt" to have the script not only show you which LineURI's you have in play, but also how many (so you don't have to count them your self).

In order to do this I had to create a function to do the counting for me.
I run a simple "foreach", calling upon the get-*** command looking for LineURIs. And for every hit, we increase the counter.

The foreach can of course be extended (and must be in order to complete my goal) with more advanced commands, as long as you write commands within ( ).

The example above was the only way I could get a reliable privateline output

I have also added a tiny "cleanup" section, so you always know your counters are 0 or $null when you reuse them..

I have updated the script posted earlier to show these counters., and the output should look something like this:

I hope you find this helpful or useful. Feedback or suggestions are appreciated :)