Link to home
Create AccountLog in
Avatar of timgreen7077
timgreen7077

asked on

Exchange 2016 Management Shell

Is there a way to load Exchange 2106 Shell to run instead of plain powershell. This will be a scheduled task, but it seems to need EMS instead of powershell only.
Avatar of Alan
Alan
Flag of New Zealand image

Hi,

I think you mean you want to run 'Exchange Management Shell'?

Is that correct?

Alan.
Avatar of timgreen7077
timgreen7077

ASKER

Yes it's the exchange management she'll. but it's exchange 2016 and the exchange ps snapin isn't supported.
ASKER CERTIFIED SOLUTION
Avatar of Jakob Digranes
Jakob Digranes
Flag of Norway image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
You just need to load within the ps script the snapin

#Load Exchange pssnapin it's not loaded
if (-not (Get-PSSnapin | Where-Object {$_.Name -like "Microsoft.Exchange.Management.PowerShell.E2010"})){ 
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 
}
else{
	write-log -level Load -Message "The Exchange PS Snap-in is already loaded"
}

Open in new window


Can be 2010 or 2013. it would work.
Add those lines before actually doing the PS exchange cmdlets calls.
https://social.technet.microsoft.com/wiki/contents/articles/38580.configure-to-run-a-powershell-script-into-task-scheduler.aspx
https://social.technet.microsoft.com/wiki/contents/articles/46768.how-to-run-a-powershell-script-with-parameters.aspx
Jose, it's Exchange 2016. That is what I'm inquiring about. Not 2010 / 2013.
It doesn't matter.
what i meant was if you use this line
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

IT will work for any exchange version, like 2010,2013 and 2016. did you even try it ?.