Category Archives: powershell

one liner for event log

We have an application whose service keeps stopping.  I have a powershell script to check for this and to restart the service, however  you can also set a property on the service to restart it on failure.  There are options … Continue reading

Posted in powershell, programming, Uncategorized | Leave a comment

hashtables – how cool is this?

http://mjolinor.wordpress.com/2012/01/29/powershell-hash-tables-as-accumulators/

I use hashtables ALOT – especially to generate counts or lists of values associated with a unique key.

Something like 

if($hash.containskey($mykey))
{
$hash.Set_Item($mykey, $hash[$mykey] + 1)
}
else
{
$hash.add($mykey,1))
} # end if/else

$hash will (shortly) contain a list of keys and their count.  You can put other things in as well.

This post by mjolinor is truly great for that (and there is more)

Continue reading

Posted in powershell | Leave a comment

outta space – again

We ran out of space on ANOTHER server again.  I wrote a script to remove entries in the tomcat\temp directory, but that was just for ‘my’ snapshot server, and hadn’t had time to extend that to the others.  So we … Continue reading

Posted in blackboard, powershell, Uncategorized | Leave a comment

Powershell and ZIP/UNZIP

The consultant wanted all the W3SVC log files.  We didn’t have them (all), but Blackboard stores them – along with other logs, in the archive directory.  In a ZIP file.  I did NOT want to unzip hundreds of archives to … Continue reading

Posted in powershell | Leave a comment