Archive for category PowerShell

Remotely install ‘Win32_Product Class’ on Server 2003


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 […]

6 Comments

Exchange 2007 Mailbox Database Reporting Script


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 […]

67 Comments

PowerShell Get-Mailbox display SMTP addresses


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 […]

98 Comments

My scripts will all be V2 from this point on.


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 […]

Leave a comment

PowerShell Dealing with Active Directory Latency


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 […]

Leave a comment

PowerShell v2 Gather remote software inventory


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 […]

1 Comment

PowerShell Find Date of a previous day in any week


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 […]

9 Comments

PowerShell Export-Csv with no header


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 […]

10 Comments

PowerShell Server Inventory Script


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 […]

2 Comments

Retrieve a list of stale Active-Sync devices


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 […]

11 Comments

Design a site like this with WordPress.com
Get started