locked
Exchange Powershell Commands Missing from EMS RRS feed

  • Question

  • I just performed a fresh install of Exchange 2013 w/ SP1 on Windows 2012 Standard R2 which is also a domain controller in an organization that already has an Exchange 2010 server (on a separate server). When I launch the Exchange Management Shell and attempt to run "Get-ExchangeServer" I get the error "The term 'Get-ExchangeServer' is not recognized as the name of a cmdlet, function, script file, or operable program..." I see that \\HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Exchange.Management.PowerShell.SnapIn is loading the module name "D:\Program Files\Microsoft\Exchange\bin\Microsoft.Exchange.PowerShell.Configuration.dll" (which is the correct path to that file).

    I've restarted the server twice and have the same issue. Also tried doing an unattended install of just the Managment Tools since using the setup GUI didn't give me the option of uninstalling and reinstalling the Management Tools since the checkbox is greyed out. I searched the ExchangeSetup log for errors and didn't find any.

    How do I get the Exchange Management Shell to register the Exchange Powershell commands? Do I need to uninstall Exchange and Re-Install?

    Wednesday, February 18, 2015 8:22 PM

Answers

  • Sounds like powershell profile issue, take a look at this article and add the "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn" to your PS profile.

    https://technet.microsoft.com/en-us/library/dd315342.aspx?f=255&MSPPError=-2147217396


    Thanks,
    MikeV
    MCSE 2012

    • Marked as answer by victornegri Thursday, July 30, 2015 7:32 PM
    Friday, July 24, 2015 7:24 PM
  • Any chance you can deploy CU9 on the Exchange Server 2013 box ? Since each Cumulative Update is essentially a full build, there's a high chance this might fix it.

    I agree it would be interesting to see what's exactly causing it, but I'm running out of ideas.

    • Marked as answer by victornegri Thursday, July 30, 2015 7:32 PM
    Wednesday, July 15, 2015 6:54 AM

All replies

  • Try running the following in your Exchange Management Shell:

    add-pssnapin "exchange" -erroraction silentlycontinue

    Then try running your command again


    Thanks,
    MikeV
    MCSE 2012


    • Edited by MikeVATX Wednesday, February 18, 2015 9:00 PM
    Wednesday, February 18, 2015 8:59 PM
  • Thanks for the reply but unfortunately that didn't solve the problem. The command you specified seemed to work (no errors) but when I try to run any Exchange powershell command "get-exchangeserver", "get-mailbox", etc, I get the same error message: "The term 'xxx' is not recognized as the name of a cmdlet, function, script file, or operable program."

    When I run get-pssnapin it shows:
    Name: Microsoft.PowerShell.Core
    PSVersion: 4.0

    So it seems as though the Exchange PowerShell snapin isn't loading.

    Interestingly, "add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010" works but "...E2013" doesn't. I can at least do some basic tasks with this but I would like to get the server functioning properly before I start migrating the users since I'm sure in the future I will need some Exchange 2013 specific powershell commands.

    Thursday, February 19, 2015 5:10 AM
  • From a remote machine, using a Powershell console started as an Exchange Organization administrator, can you try creating and importing a remote PSSession to the Exchange server ?The steps are detailed here. After importing the session, try doing a Get-ExchangeServer.
    Thursday, February 19, 2015 8:11 AM
  • Hi Victor,

    can you run any command at all?The account you tried to run this command,which Group is it member of?


    Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you. Thank you! Off2work

    Thursday, February 19, 2015 8:56 AM
  • Albert, it looks like Exchange powershell commands work when creating and importing a remote session to the Exchange server. I am able to run Exchange 2013 PS commands (e.g. Get-ExchangeServerAccessLicense, Get-MobileDevice, etc) using this method. Now the question is, why don't they run locally?
    Thursday, February 19, 2015 2:55 PM
  • Just to eliminate something simple - doing a 'whoami' inside the local Powershell console on the server indicates the same  administrator account that could successfully logon remotely, correct ?
    Thursday, February 19, 2015 2:58 PM
  • Off2work, yes, other basic (non-Exchange) Powershell commands work. User is a member of Organization Management and is an Enterprise Admin, Domain Admin, and Schema Admin so they should have full rights to everything. 
    Thursday, February 19, 2015 2:58 PM
  • Albert, yes, the same user is logged into both computers (local Exchange server and computer where I started the remote powershell session). Verified with whoami.
    Thursday, February 19, 2015 4:53 PM
  • please try to add user to Exchange org Admin,log out and back in again to server and try to run command again.Error Message seems like permission issue.

    Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you. Thank you! Off2work

    Friday, February 20, 2015 7:19 AM
  • As stated above, the user is part of the Organization Management role already, which (unless I'm confused) is the highest-level role I can assign someone to for Exchange 2013.
    Friday, February 20, 2015 11:51 PM
  • Organization mnagement role doesnt grant you permission to manage Exchange server,for this you will need server management role: https://technet.microsoft.com/en-us/library/dd876866(v=exchg.150).aspx

    https://technet.microsoft.com/en-us/library/dd638114(v=exchg.150).aspx

    Plese give it a try and see if it helps


    Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you. Thank you! Off2work

    Sunday, February 22, 2015 11:36 AM
  • Added user to Server Management role and there is no change. Still cannot access the Exchange shell commands from the Exchange Management Console.

    Sorry for the lag in response, I'm not getting the alerts that there is a reply.

    Monday, February 23, 2015 4:54 AM
  • did you log out and back in again on the server after you added Group?

    Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you. Thank you! Off2work

    Monday, February 23, 2015 10:50 AM
  • Yes. Still cannot access the Exchange shell commands.
    Thursday, February 26, 2015 6:17 PM
  • I don't think we set up split permissions in the domain/Exchange environment (unless I did it inadvertently). And there's nothing that says that installing Exchange on a domain controller makes it so that you can't use Exchange commands in the Exchange Management Console locally. That seems like something else entirely. 
    Thursday, March 5, 2015 4:39 PM
  • Try below and confirm if that works.

    1. Close Exchange Management Shell

    2. Start -> Run -> %Appdata%

    3. Open Roaming => Microsoft => Exchange => RemotePowershell

    4. Delete or rename thethe folder which will have the nam equal to your Exchange server server1.domain.com

    5. Open Exchange Management Shell and wait for the RBAC Stack authorization to complete where cmdlet will be added.

    ***VOTE IF HELPFUL / MARK ANSWER IF ANSWERS ***


    Pavan Maganti ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful" if it really helps and "Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your question. ~~ This Information is provided is "AS IS" and confers NO Rights!!

    • Proposed as answer by Hoang Luu Huy Wednesday, July 8, 2015 8:07 AM
    Thursday, March 5, 2015 8:24 PM
  • PK M, sorry, that didn't work either. I still can't run Exchange commands locally. Verified that re-launching the EMS created a new entry with my server name in \Microsoft\Exchange\RemotePowershell. 
    Thursday, March 5, 2015 8:29 PM
  • Open Powershell as Administrator.

    1. Add-Pssnapin *Setup*

    2. Install-CannedRbacRoleAssignments -InvocationMode Install -verbose

    3. Install-CannedRbacRoleAssignmentSRAP -InvocationMode Install -verbose

    4. Install-CannedRbacRoles -InvocationMode Install -verbose

    Try the above commands and let me know if that helps

    if that doesn't can you run the below command reply back with the output

    Get-Command |?{$_.Name -like "Get-Exchange*"}

    ***VOTE IF HELPFUL / MARK ANSWER IF ANSWERS ***


    Pavan Maganti ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful" if it really helps and "Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your question. ~~ This Information is provided is "AS IS" and confers NO Rights!!



    • Edited by PK M Thursday, March 5, 2015 9:08 PM
    Thursday, March 5, 2015 8:50 PM
  • Ran the commands above. Steps 1 and 2 worked fine. Steps 3 and 4 were unrecognized commands.  Still can't run Exchange commandlets.

    Here is the output of Get-Command |?{$_.Name -like "Get-Exchange*"}:

    CommandType     Name                                               ModuleName                                          
    -----------     ----                                               ----------                                          
    Cmdlet          get-ExchangeServerGroupSid                         Microsoft.Exchange.Management.PowerShell.Setup      
    
    

       

    Thursday, March 5, 2015 11:16 PM
  • this works for me.
    Wednesday, July 8, 2015 8:08 AM
  • I checked out that article you linked but unfortunately it's not the same issue. When I run "get-pssnapin -registered" I get the following list: 

    Name        : EnginePSSnapin
    PSVersion   : 2.0
    Description : Register cmdlets for Content Engine

    Name        : HostControllerPSSnapIn
    PSVersion   : 2.0
    Description : Register cmdlets for Host Controller

    Name        : InteractionEnginePSSnapIn
    PSVersion   : 2.0
    Description : Register cmdlets for InteractionEngine

    Name        : JunoPSSnapin
    PSVersion   : 2.0
    Description : Register cmdlets for Juno

    Name        : Microsoft.Exchange.Management.PowerShell.E2010
    PSVersion   : 1.0
    Description : Admin Tasks for the Exchange Server

    Name        : Microsoft.Exchange.Management.PowerShell.Setup
    PSVersion   : 1.0
    Description : Setup Tasks for the Exchange Server

    Name        : Microsoft.Exchange.Management.PowerShell.SnapIn
    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

    Name        : Microsoft.Forefront.Filtering.Management.PowerShell
    PSVersion   : 2.0
    Description : Microsoft Forefront Filtering PowerShell Interface

    Name        : SearchCorePSSnapIn
    PSVersion   : 2.0
    Description : Register cmdlets for SearchCore

    Also when I look at the registry, all of the keys that should exist do exist

    Wednesday, July 8, 2015 4:10 PM
  • Victor, what happens if you build a PSSession and import it from within the local machine itself, using the same procedure used earlier to connect remotely. Depending on the outcome, it might hint where to look next. Should this test be successful, it might be pointing to issues with the EMS shortcut invoking RemoteExchange.ps1.
    Thursday, July 9, 2015 7:16 AM
  • If I build a PSSession and import it within the local machine it works. 

    Don't know if this helps but this is what the EMS shortcut is running:

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'D:\Program Files\Microsoft\Exchange\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell "

    Thursday, July 9, 2015 3:38 PM
  • The shortcut is for a Powershell script that sets up various variables and loads Exchange related-types. The scripts is signed, so if text would be garbled it would fail to execute - so it's either one of the .ps1xml types or underlying .dlls being referenced that are broken, or some other subsystem the script depends on to run is broken (.NET underlying functions used only in the "client"-side connection, but not affecting the remote PS method tested earlier).

    Checking all the referenced files against a baseline install might take time. It might be quicker to do a quick health check of the server first - there's a script release by Microsoft here that checks a bunch of things. Can you give it a go and let us know if it flags something critical ?

    Thursday, July 9, 2015 4:25 PM
  • This is the output of the health check. I imported the PSSession prior to running this and specified the FQDN of the server instead of localhost. (changed server name and domain name to generic in the output)

    Calling Main Script Execution
    Calling Normalize-ProcessorInfo
    Calling Get-ServerRole
    Calling Get-OperatingSystemVersion
    Calling Get-LocalOperatingSystemVersion
    Calling Get-NetFrameWorkVersion
    Calling Write-SystemInformationToConsole
    Exchange 2013 Health Checker version 1.12
    System Information Report for servername.domain.local on 07/09/2015 09:34:07

    Hardware/OS/Exchange Information:
    Hardware Type: Physical
    Manufacturer: Dell Inc.
    Model: PowerEdge T430
    Operating System: Microsoft Windows Server 2012 R2 Standard
    Exchange: Version 15.0 (Build 847.32)
    Server Role: MultiRole
    Pagefile Settings:
    Error: System is set to automatically manage the pagefile size.  This is not recommended.
    .NET Framework:
    Version: 4.5.2
    Power Settings:
    Power Plan: High performance
    NIC settings per active adapter:
    Interface Description: Broadcom NetXtreme Gigabit Ethernet #3
    Warning: NIC driver is over 1 year old.  Verify you are at the latest version.
    Driver Date: 2013-12-19
    Driver Version: 16.4.0.2
    Link Speed: 1000 Mbps
    RSS: Enabled
    Processor/Memory Information:
    Processor Type: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
    Physical Memory: 65437 MB
    Number of Processors: 2
    Number of Physical Cores: 12
    Megacycles Per Core: 2397
    Number of Logical Processors: 24
    Hyper-Threading Enabled: Yes --- Warning: Enabling Hyper-Threading is not recommended
    Database and Mailbox Statistics:
    Calling Get-DatabaseAndMailboxStatistics
    Active Databases:
    Mailbox Database 0311853838\servername
    No Active Mailboxes found on server.

    Passive Databases:
    No Passive Mailboxes found on server.



    Output file written to .\HealthCheck-servername.domain.local-07092015093404.log

    Thursday, July 9, 2015 4:41 PM
  • Any chance you can deploy CU9 on the Exchange Server 2013 box ? Since each Cumulative Update is essentially a full build, there's a high chance this might fix it.

    I agree it would be interesting to see what's exactly causing it, but I'm running out of ideas.

    • Marked as answer by victornegri Thursday, July 30, 2015 7:32 PM
    Wednesday, July 15, 2015 6:54 AM
  • I installed CU9 during a maintenance window but it didn't fix the problem. I still can't run Exchange commands in Powershell on the local server. "Get-Mailbox" (or any other Exchange command) is not recognized as the name of a cmdlet...
    Thursday, July 23, 2015 5:06 PM
  • May be worth trying the powershell command again after cu9:

    add-pssnapin "exchange" -erroraction silentlycontinue


    Thanks,
    MikeV
    MCSE 2012

    Thursday, July 23, 2015 7:39 PM
  • Ran the add-pssnapin command and it did not make any difference. I also just tried add-pssnapin "exchange" and it gave me the error "The Windows PowerShell snap-in 'exchange' is not installed on this computer."

    I then ran "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn" and it worked and now I am able to run Exchange powershell commands. But when I close the EMC and reopen I have to re-run that command to get it to work. I know that this should be running on-load based on the reg key listed in my initial post. Any ideas on how to force it to run again on-load?

    At least we're making progress!

    Thursday, July 23, 2015 7:54 PM
  • Sounds like powershell profile issue, take a look at this article and add the "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn" to your PS profile.

    https://technet.microsoft.com/en-us/library/dd315342.aspx?f=255&MSPPError=-2147217396


    Thanks,
    MikeV
    MCSE 2012

    • Marked as answer by victornegri Thursday, July 30, 2015 7:32 PM
    Friday, July 24, 2015 7:24 PM
  • Thanks!
    Thursday, July 30, 2015 7:32 PM
  • That worked for me, thanks
    • Proposed as answer by Jon Redwood Tuesday, July 7, 2020 10:35 AM
    Tuesday, July 7, 2020 10:35 AM