Exchange 2007 Management Shell on Win 7 64 bit not starting?

I am having a problem starting Exchange 2007 Management Shell on my Windows 7 64 bit computer.
If I take the menu option which has a target of: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'", I get the error: Internal Windows Powershell error.  Com initialization failed while reading Windows Powershell console file with error 80010106.

However, if I start a command prompt and run things separately, I can get it to start.
1) C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2) Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
3) cd "c:\program files\microsoft\exchange server\bin"
4) .\Exchange.ps1

The very end of my Path variable contains:C:\Program Files\Microsoft\Exchange Server\bin;C:\Program Files\Microsoft\Exchange Server\Scripts, so I don't think its a path issue.

Is there something special that needs to be done in Windows 7 or a 64 bit system?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

CitizenRonConnect With a Mentor Commented:
That's odd, I don't have Exchange Mgmt but I have the VMWare Toolkit that has a similar PSC1 file.  Inside the file the PSVersion is listed as 1.0 but when I export it manually, it shows as 2.0.  Perhaps something wrong with your PowerShell 2 installation?

The only other thing I can think of is doing a work-around.  Since the shortcut includes running the following script:
C:\Program  Files\Microsoft\Exchange Server\bin\Exchange.ps1
maybe you could just add the
Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
line to the beginning of the Exchange.ps1 script?
It looks like the error is when you are loading the PSConsole portion:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange  Server\bin\exshell.psc1" -noexit -command ". 'C:\Program  Files\Microsoft\Exchange Server\bin\Exchange.ps1'"
Open the "C:\Program  Files\Microsoft\Exchange  Server\bin\exshell.psc1" file and see what SnapIns it is trying to load.  You normally can't run a .PSC1 file from the PowerShell console, it has  to be loaded with the PowerShell.exe program using the -PSConsoleFile  switch.  If you find out which SnapIns are in the list, you can usually just load them at the PowerShell prompt using the "Add-PSSnapIn" cmdlet.

If possible, post the contents of that .psc1 file.
Okay, I reread that just now and I'm going to guess that the only snapin in the exshell.psc1file is the "Microsoft.Exchange.Management.Powershell.Admin" snapin?

Try this:
  • Rename the "C:\Program Files\Microsoft\Exchange  Server\bin\exshell.psc1" file to something else.
  • Load powershell.exe and run the following
    • Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
    • .\'c:\program files\microsoft\exchange server\bin\Exchange.ps1'
  • Run Get-PSSnapin to make sure that the Exchange Management SnapIn is loaded
  • Export the currently loaded SnapIns as a new PSConsole file:
    • Export-Console  -Path "C:\Program  Files\Microsoft\Exchange  Server\bin\exshell.psc1"
Once you do that, see if the shortcut works properly.

Also, please post the original contents of the .psc1 file, maybe there's just a typo in it.
Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

sjiinfosysAuthor Commented:
I renamed the exshell.psc1 file, and exported a new one.  Both the old and new files contain:
<?xml version="1.0" encoding="utf-8"?>
<PSConsoleFile ConsoleSchemaVersion="1.0">
    <PSSnapIn Name="Microsoft.Exchange.Management.PowerShell.Admin" />

The shortcut still produces the same error.

After running all the steps separately, I do see the Exchange Management Snapin when I run Get-PSSnapin.
sjiinfosysAuthor Commented:
Other things I should note are:
I am running Exchange 2007 SP2.  And it appears I am running Powershell 2.0.  When I run Get-Host, it says version 2.0.

On my server running Windows 2003 server 64 bit and Powershell 1.0 and Exchange SP2, the shortcut works.  Nonetheless, Microsoft claims that Exchange SP2 build  works with PS 2.0.
sjiinfosysAuthor Commented:
You are correct.  When I do the export the version is different.  It does show 2.0, and not 1.0.  However, that is the only difference.  I overlooked that.

When I run Get-PSSnapin, it says version 1.0 next to Microsoft.Exchange.Management.Powershell.Admin.

Your suggested work-around did work.  However, that means I also have to change my batch files I have to automate some Exchange management functions.  I use the PSConsoleFile in them also.

I will give it another day before awarding points to see if there is a solution that doesn't involve modifying the Microsoft files and shortcuts.

Thanks for your assistance thus far.
sjiinfosysAuthor Commented:
As note, this is a work-around.  As with many things Microsoft, I would probably need a re-install to get things working as they should.
I have encountered the same error when trying to open the mgt shell.  Any other solutions other than the work-around?  Thanks
Same issue happened to me on Exchange 2007 SP3/Server 2008 R2. Found a fix somewhere as follows:

Go to Start Menu=>Customize=>Number of recent items to display in jump lists.

Make sure it is great than 0.
All Courses

From novice to tech pro — start learning today.