[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using Exchange 2007 cmdlets in custom Powershell application

Posted on 2008-06-11
6
Medium Priority
?
1,443 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Accepted Solution

by:
BSonPosh earned 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Suggested Courses

649 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