Solved

Using Exchange 2007 cmdlets in custom Powershell application

Posted on 2008-06-11
6
1,434 Views
Last Modified: 2013-11-07
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
Comment
Question by:PhilCorps
  • 3
  • 3
6 Comments
 

Author Comment

by:PhilCorps
ID: 21761260
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
 
LVL 18

Expert Comment

by:BSonPosh
ID: 21762832
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
 

Author Comment

by:PhilCorps
ID: 21762914
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 18

Accepted Solution

by:
BSonPosh earned 500 total points
ID: 21762928
ah... to get ALL the info you need to pipe to format-list *

get-pssnapin -reg | fl *
0
 
LVL 18

Expert Comment

by:BSonPosh
ID: 21762933
Its called ModuleName
0
 

Author Closing Comment

by:PhilCorps
ID: 31466180
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

The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

Join & Write a Comment

Suggested Solutions

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now