Cmdlets and Parameters – Differences between Exchange 2007 and 2010

June 15, 2010

Exchange 2010 adds a lot of new commands to the Exchange Management Shell (EMS). In addition to the new commands, some commands were removed and some cmdlet parameters have changed. To find all the changes between the two versions of Exchange I put together a script that produces a collection of custom objects. By querying these objects you can find if a command or its parameters are new or removed. The changes are recorded in an XML file (compare.xml) which you can use to filter a specific command.

To compare the changes I ran a script, on each version of Exchange, that exports all the Exchange commands (Name and a list of parameters) to an XML file using the Export-CliXml cmdlet.

 

#Exchange 2007 SP2 (Thanks Mike!)
Add-PSSnapin Microsoft.Exchange* -ErrorAction SilentlyContinue
Get-Command -Module Microsoft.Exchange* | Select-Object Name,@{n=’Parameters’;e={$_.Parameters.Keys}} | Export-CliXml .\2007.xml

 

#Exchange 2010 Update Rollup 1
Get-Command -Module $importResults | Select-Object Name,@{n=’Parameters’;e={$_.Parameters.Keys}} | Export-CliXml .\2010.xml

 

Once the XML files have been created I imported them back using the Import-CliXml cmdlet and then processed the differences with the compare.ps1 script.

 

 image

When the script completes it exports the changes to the compare.xml file in the script’s directory.

 

image
 

The objects version of the script defines four properties for each command:

  • Name – The name of the command.
  • State– Determines if the command is new to Exchange 2010. Possible values:
       New – New command in 2010. 
       Removed – The command doesn’t exist in 2010. 
       Blank – Command exists in both versions of Exchange, look for changes in the NewParameters or RemovedParameters properties
  • NewParameters – A list of new parameters.
  • RemovedParameters – A list of removed parameters.

The script and xml files can be downloaded from HERE. Make sure to extract all files to a single directory before you run the script.

 

Examples:

# Get all removed commands
$compare | Where-Object {$_.State –eq ‘removed’}

# Get all new commands
$compare | Where-Object {$_.State –eq ‘new}

# Get a list of removed parameters for cmdlets that exists in Exchange 2007 and 2010
$compare | Where-Object {!$_.State -AND $_.RemovedParameters} | Select-Object Name,RemovedParameters

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*