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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Justin YeungSenior Systems EngineerCommented:
did you try run as administrator?
DanNetwork EngineerAuthor Commented:
yes, even when I run as administrator, still get the same error.
Jose Gabriel Ortega CastroEE Rookie/Solution Guide/Topic Advisor and CEO Faru Bonon ITCommented:
Use the icon "Exchange Management Shell" that would make the psnapin load of that for you.

Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

DanNetwork EngineerAuthor Commented:
yes, that's the icon I always use
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

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.
Jose Gabriel Ortega CastroEE Rookie/Solution Guide/Topic Advisor and 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).
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.
Jose Gabriel Ortega CastroEE Rookie/Solution Guide/Topic Advisor and CEO Faru Bonon ITCommented:
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?
Jose Gabriel Ortega CastroEE Rookie/Solution Guide/Topic Advisor and 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.
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.
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)

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
DanNetwork EngineerAuthor Commented:
Thanks everyone for your input,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.