Using Exchange 2007 cmdlets in custom Powershell application

I have created an application in VB.net to simplify my jobs powershell tasks. Everything works fine when it comes to the script, and in essence all non-Exchange cmdlets work fine, i.e. Get-Process.

The issue is I cannot use the Exchange 2007 cmdlets. I am running this program on an Exchange server on which I would previously use to execute the cmdlets directly from Powershell, and they work fine when I input them in, but when I do it programmatically it says:

"Error in script: The term 'Get-Mailbox' is not recognized as a cmdlet, function, operable program, or script file."

Any assistance would be greatly appreciated. If you need to see code please let me know.
PhilCorpsAsked:
Who is Participating?
 
BSonPoshConnect With a Mentor Commented:
ah... to get ALL the info you need to pipe to format-list *

get-pssnapin -reg | fl *
0
 
PhilCorpsAuthor Commented:
I am wondering if there is a seperate System.Management.Automation.dll file that is used to reference Exchange 2007 cmdlets, anyone know if this would be the case?
0
 
BSonPoshCommented:
There are a whole set of Exchange DLLs that you need.

You can see these on the Exchange Machine by doing this
Get-PSSnapin -Reg
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
PhilCorpsAuthor Commented:
I did that command on the exchange server and this is what I got back:

[PS] C:\Documents and Settings\administrator.EXCHHOSTING\Desktop>get-pssnapin -reg

Name        : Microsoft.Exchange.Management.PowerShell.Admin
PSVersion   : 1.0
Description : Admin Tasks for the Exchange Server

Name        : Microsoft.Exchange.Management.Powershell.Support
PSVersion   : 1.0
Description : Support Tasks for the Exchange Server

Not really sure what DLL's those are referencing or which ones to get though.
0
 
BSonPoshCommented:
Its called ModuleName
0
 
PhilCorpsAuthor Commented:
Great job, that gave me the right direction, but I still had to figure out how to implement that into .NET. I needed to use the AddSnapIn feature to add the exchange parts.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.