Skip to Content

Blogs

Reading Help Files

One of my earliest uses of PowerShell was to get information through WMI queries on our Exchange 2003 servers. It worked and gave us the information I needed. Recently I came across a post from Don Jones on reading the PowerShell help files more closely. He's right you should.

The new script seems faster as well. I should probably look at those performance test cmdlets the MVPs all run from time to time to see if it's a real performance kick or subjective.

# Gets data through WMI from specified Exchange mailbox servers
$computers = "server001","server002"
Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer $computers | sort-object -desc MailboxDisplayName | select-object MailboxDisplayName,StorageGroupName,StoreName,Size

Compare it to my original code.

Of course, it probably helps if you're a better script writing then I am and have a better understanding of all the jargon you're reading, but this is why I like the blogs, you generally learn something often enough that really helps out later.

The value of digging through an SDK

SDKs are really for programmers but have value for scriptor writers as well. A while ago I found a script to returns the version of VMware tools on guest systems (I didn't write it and wish I'd kept the source link but it does what I needed).

$date=get-date -uformat "%Y%m%d-%H%M%S"; get-vm | % { get-view $_.ID } | select Name, @{ Name="hostName"; Expression={$_.guest.hostName}}, @{ Name="ToolsStatus"; Expression={$_.guest.toolsstatus}}, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}} | sort-object name | Export-Csv vmtoolsver_$date.csv

Recently my co-worker did some upgrades to our clusters and ran the script and noted that a large portion of our VMware Tools were behind a version or two. He noted that several of our guest systems did not have the option checked in Edit Settings > Options > VMware Tools Check and upgrade Tools before each power-on' so he sent an email for people to manually check at the next opportunity. I figured there must be a PowerShell script way.

PowerShell tutorial series

There are a lot of blog posts and books about PowerShell and with the blogging about CTP for PowerShell v2 going on, it can get even more confusing. Having succeeded in getting another co-worker seriously interested in PowerShell I sent him one of my recent tutorial finds and dug out an older one from my delicious bookmarks. To make it easier for me to give the links to friends, here are the links to both series. Each has a different approach that provides some significant value.

Contributing is about giving

Contributing is about giving. People do so for many reasons but at it's core it is about giving.

For me, it is not now nor has it ever been about 'getting back'. It has not been about reputation, karma, fame. It has been about solving my needs and helping others solve theirs in a way that encouraged them to share so I too could learn in kind.

export-activeLCSusers

This applies to LCS 2005sp1 environments but should also work on OCS2007 environments.

The challenge was to generate a list of LCS enabled users that were not disabled. I have a WMI query that will generate a list of LCS users, but I really wanted to be able to filter out the disabled users.

Get-WmiObject msft_sipesusersetting -filter "Enabled = true" | Select-Object DisplayName

As I had some other needs at the time, I added the telephone information as well to the query. Using get-member you can find a number of other different pieces of useful information to gather as well.

reviewing text log entries

We use TDP for Exchange for our backup program. It's an interesting program and I will save my opinion of it for another time, but one of the things we've learned to do it to check the last 20 lines of the log file on each Exchange server daily for success/failure/issue of the backups. This process will work for checking multiple text files across several servers assuming the files are located in the same path.

I figured that the Get-Content cmdlet was the starting point I was looking for. Sure enough it got the log.

Get-Content "\\server001\c$\Program Files\Tivoli\TSM\TDPExchange\excsch.log

Big log, too much information.

Syndicate content