Solved

Using Exchange 2007 cmdlets in custom Powershell application

Posted on 2008-06-11
6
1,438 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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Read this checklist to learn more about the 15 things you should never include in an email signature.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…

730 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