exchange snapin problem

why is it that everytime I open up exchange shell, I have to type the following command, or I get the error "the term "command" is not recognized as the name of a cmdlt....."

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

Is there a way to have this stick, so I don't have to do this every time I open the exchange shell?
DanNetwork EngineerAsked:
Who is Participating?
 
Tom CieslikIT EngineerCommented:
Check you installation directory
C:\Program Files\Microsoft\Exchange Server\V15\Bin
If you have all scripts available in this location (or maybe one of file is corrupted)

Capture.JPG
If not please copy from installation media directly to your Bin Folder.
You can find files on your installation DVD   \setup\serverroles\common:

If you don't have it, I can zip it for you
0
 
Justin YeungSenior Systems EngineerCommented:
did you try run as administrator?
0
 
DanNetwork EngineerAuthor Commented:
yes, even when I run as administrator, still get the same error.
0
WEBINAR: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

 
Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
Use the icon "Exchange Management Shell" that would make the psnapin load of that for you.

emc.png
0
 
DanNetwork EngineerAuthor Commented:
yes, that's the icon I always use
shell
0
 
Nicky RavenTechnical Services AnalystCommented:
I have a template that use to connect to our exchange from my system that is unambiguous so you could change this to your liking. (see below)

I have the Exchange console installed on my system as that is where the snap-in is located so you may need to do the same.. see the link for how to do this on a system other than the exchange server as it is already installed ther

Local Exchange 2010 install for windows 7

## Ask for Users Credential
$UserCredential = Get-Credential
$PSDefaultParameterValues = @{"*-AD*:Credential"=$UserCredential}

## This Pice of code goes thugh the snapin's for each of the differant enviroments for extedned use on the exchnage server
## Exchnage 2007 ##
if ((Get-PSSnapin | ? { $_.Name -eq "Microsoft.Exchange.Management.PowerShell.Admin" }) -eq $null) {
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue}

## Exchnage 2010 ##
if ((Get-PSSnapin | ? { $_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010" }) -eq $null) {
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue}

## Exchnage 2013 & 2016 ##
if ((Get-PSSnapin | ? { $_.Name -eq "Microsoft.Exchange.Management.PowerShell.Snapin" }) -eq $null) {
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin -ErrorAction SilentlyContinue}

## Active Directory Module add code
function Check-LoadedModule
{ Param( [parameter(Mandatory = $true)][alias("ActiveDirectory")][string]$ActiveDirectory)
  $LoadedModules = Get-Module | Select Name
  if (!$LoadedModules -like "*ActiveDirectory*") {Import-Module -Name ActiveDirectory}}

## Exchnage Server Connection
$ExchName = Get-ADGroup -Identity "Exchange Servers" | Get-ADGroupMember | where {$_.objectclass-eq "computer"} | select -ExpandProperty NAME
$Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$ExchName.$Domain/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session -AllowClobber


<# Exchnage Code  for what you want to do to go Hear #>


Remove-PSSession $Session

Open in new window


Hopefully this help

regards
HizShadow
0
 
DanNetwork EngineerAuthor Commented:
I'm running the exchange management shell ON the Exchange server, not on any other computer, that's why I find it very strange that I have add the snapin every time I run the program.
0
 
Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
Well what is happening with exchange server, it's that it does PSREMOTING into the "exchange server" sometimes it doesn't work, and when it fails you need to add the snap-in manually to get it working, when you click the exchange management console ( which is a shortcut it load the snaping behind scenes, if it fails, you need to do it manually).
0
 
DanNetwork EngineerAuthor Commented:
Well, whatever it's suppossed to do behind scenes, it's not working, it fails everytime.   So is there a log I can look at to see why it's failing?
There has to be a reason, it's strange for it to fail every time I start the management console.
0
 
Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
0
 
DanNetwork EngineerAuthor Commented:
I am running exchange 2013, not 2007.
I just restarted the server, tried to open the exchange toolbox and I get this error message:
"the term 'get-queue' is not recognized as the name of a cmdlet, function, script file, or etc...."
So I'm logged on my exchange server directly, with full domain admin rights.
This is poor programming on MS, I'm sorry.  I'm just so tired of MS.

So I manually in the exchange shell, ran the command,
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

It was successful, but when I go to open up the toolbox, I'm still getting that error message.

So what do I do next?
0
 
Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
The toolbox should load the snapin by itself.
if you go to the ps console and run the add snap-in, don't expect the toolbox to run. that's not how it works.

If you open a poweshell console and run commands, they are alive in that "particular Session" you can't transfer the loaded snap-in between windows or tools, they are session independent, this doesn't work like the operating system.

If your exchange toolbox doesn't work, you should go to the event viewer and start looking at the errors and warnings there.
0
 
DanNetwork EngineerAuthor Commented:
Yes I know that  if I run the command in the shell, it doesn't apply to the toolbox, but I thought it's worth it :)
That's why I even restarted the server.  I looked through the event log and there's nothing there that looks like it's something causing a problem.
0
 
DanNetwork EngineerAuthor Commented:
Tom, I have every file that you listed in my bin folder.  I just double checked.

At this point, it's not worth my time to try to recopy the files, as I'm planning to install EX2016 tonight on a new server.
0
 
DanNetwork EngineerAuthor Commented:
Thanks everyone for your input,
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.