While researching PowerShell commands for an article I was writing (PowerShell commands added with SP3) I realized that two of my Exchange 2010 SP2 test labs were reporting different commands available for use. One lab was built a long time ago as an Exchange 2010 RTM server, eventually upgraded to SP1 and then to SP2 [SP3 will have to be done at another date]. The second lab was a straight Exchange 2010 SP2 build with no upgrades done over time. Since both of these labs are Service Pack 2, you would think that the available PowerShell commands would be exactly the same. They are not.
Lab 1 has these commands available to it – Lab1 PowerShell.
Lab 2 has these commands available to it – Lab2 PowerShell.
As you can see these lists are not equivalent. Lab 1 has an additional 19 commands that Lab 2 does not. These commands included:
The question is, why are they different? First, let’s look at the exsetup file to make sure these servers are the same install base:
Let’s also look to see what modules are loaded on the install for PowerShell in each lab:
In our case we only have one module that is loaded in both lab environments.
Where is Exchange pulling these command lists from then? Well, there are a couple of reference files for PowerShell. These files are as follows:
XML File – The Format.ps1xml files in Windows PowerShell define the default display of objects in the Windows PowerShell console. You can create your own Format.ps1xml files to change the display of objects or to define default displays for new object types that you create in Windows PowerShell. [Source]
.Psd1 – A module manifest is a .psd1 file that contains a hash table. The keys and values in the hash table:
* Describe the contents and attributes of the module.
* Define the prerequisites.
* Determine how the components are processed.
.Psm1 – A script module is a file (.psm1) that contains any valid Windows PowerShell code. Script developers and administrators can use this type of module to create modules whose members include functions, variables, and more.
OK. So what are the differences in these files between lab 1 and lab 2?
I ran a check of the files via this link – http://www.diffchecker.com/diff
The .XML files showed no difference at all.
The same was found on the .PSD1 files.
However, in the .PSM1 files there are numerous things that are indeed different:
The above screenshots are not comprehensive of the changes that can be found in these files. Even with the above information, we are no closer to finding an answer to the ‘Why’ question I raised at the very top of this post. I am still investigating the issue, but I have not been able to find any more a definitive answer than timing. I applied SP2 for Exchange 2010 in Lab 1 when it first came out and in April 2013 for Lab 2. Does this mean that SP2 files have changed over time? I don’t know as I am still looking for my original SP2 for Lab 1.
If anyone has any knowledge on this please drop a comment. Thanks.