[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1446
  • Last Modified:

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.
0
PhilCorps
Asked:
PhilCorps
  • 3
  • 3
1 Solution
 
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
 
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
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
BSonPoshCommented:
ah... to get ALL the info you need to pipe to format-list *

get-pssnapin -reg | fl *
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now