Archive for category PowerShell
Remotely install ‘Win32_Product Class’ on Server 2003
Posted by Karl Mitschke in PowerShell, Server 2003, WMI on February 13, 2010
In a previous post (PowerShell v2 Gather remote software inventory), I lamented the fact that Server 2003 does not include the Win32_Product class by default. (http://blogs.msdn.com/wmi/default.aspx) I was asked to install it on our 500 Server 2003 boxes via a script. I built a few test VM’s, and configured the Win32_Product class via “Add/Remove Windows […]
Exchange 2007 Mailbox Database Reporting Script
Posted by Karl Mitschke in 2007, Exchange, PowerShell, V2 on January 27, 2010
We use the following script to report on Exchange 2007 Mailbox Database usage. I will be modifying it for 2010 soon – watch this space 🙂 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 […]
PowerShell Get-Mailbox display SMTP addresses
Posted by Karl Mitschke in 2007, 2010, Exchange, PowerShell, V2 on January 27, 2010
A question was posed recently where a user wanted to see a list of all his mailboxes, with their server, primary SMTP address, and any additional SMTP addresses associated with the mailbox. The user specifically wanted ONLY SMTP addresses. With the help of a scriptblock, I was able to solve this on one line: 001 […]
My scripts will all be V2 from this point on.
Posted by Karl Mitschke in PowerShell, V2 on January 14, 2010
PowerShell V2 has been available for all platforms since late October, 2009, so from now on all my scripts will be tested only on V2. I may post older scripts that work on V1, and in fact my new scripts may as well, but I won’t be testing them unless someone specifically asks for a […]
PowerShell Dealing with Active Directory Latency
Posted by Karl Mitschke in 2007, Exchange, PowerShell, V1, V2 on January 8, 2010
Consider the following: 001 002 003 004 005 006 007 New-DistributionGroup -Name "karls test group" ` -SamAccountName "karlstestgroup" ` -DisplayName "Karls Test" ` -Type "Security" ` -OrganizationalUnit "contoso.com/Test/EmailTest" Add-DistributionGroupMember ` -Identity "karlstestgroup" -Member "karlmitschke@contoso.com" If you have latency in your Active Directory, you most likely will get an error on the “Add-DistributionGroupMember” command: Add-DistributionGroupMember : The operation could not be performed because ‘karlstestgroup’ could not be found. Note that […]
PowerShell v2 Gather remote software inventory
Posted by Karl Mitschke in PowerShell, V2 on December 23, 2009
I was recently asked to gather information on every Adobe product installed on 576 Windows servers. I thought this would be no problem, because I could use Get-WmiObject with the Win32_Product Class and go home early. Alas, it was not to be: Per the WMI blog (http://blogs.msdn.com/wmi/default.aspx), Windows Server 2003 doesn’t have the Win32_Product Class […]
PowerShell Find Date of a previous day in any week
Posted by Karl Mitschke in PowerShell, V1, V2 on December 19, 2009
I often need to name a file with a date as part of the file name like: ServerInventory12-18-2009.csv A simple $date = $(get-date).ToString(“MM-dd-yyyy”) works great for today, but I recently had a need to create a file once a week, with a file name of the previous Saturday. I had come across Arul Kumaravel’s WebLog […]
PowerShell Export-Csv with no header
Posted by Karl Mitschke in PowerShell, V2 on December 15, 2009
I’m working on a project that provides billing information on 1 specific service – Lyris ListManager messages sent by company (Or in ListManager parlance, site) I had all the data, and exported it to a csv as that was the format that we agreed to provide to the billing people. Life was good for about […]
PowerShell Server Inventory Script
Posted by Karl Mitschke in PowerShell, WMI on December 10, 2009
I was asked for my Server Inventory script on the newsgroup Microsoft.Public.Windows.PowerShell. This is my script, in a slightly compressed and sanitized version – Compressed as I stripped out Novell, Unix, and ESX Host logic, sanitized in that I don’t really have a domain contoso.com 😉 After the script, if you stick around, I will […]
Retrieve a list of stale Active-Sync devices
Posted by Karl Mitschke in 2007, Exchange, PowerShell, V1 on December 4, 2009
We allow users who have signed the proper policy to access their Exchange mailbox via Active Sync devices. Users being users, though, we quite often have active sync devices that are registered to a mailbox, but are no longer in use. Users always have a clever excuse like “Oh, i lost that last year”, or […]


