Exchange 2016 Management Shell

timgreen7077
timgreen7077 used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AlanConsultant

Commented:
Hi,

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

Is that correct?

Alan.
timgreen7077Exchange Engineer
Distinguished Expert 2018

Author

Commented:
Yes it's the exchange management she'll. but it's exchange 2016 and the exchange ps snapin isn't supported.
Commented:
take a look here - remote powershell should do the trick; https://technet.microsoft.com/en-us/library/dd335083(v=exchg.160).aspx
Jose Gabriel Ortega CastroCEO Faru Bonon IT /Top Rated Freelancer on Upwork / Photographer
Awarded 2018
Distinguished Expert 2018

Commented:
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
timgreen7077Exchange Engineer
Distinguished Expert 2018

Author

Commented:
Jose, it's Exchange 2016. That is what I'm inquiring about. Not 2010 / 2013.
Jose Gabriel Ortega CastroCEO Faru Bonon IT /Top Rated Freelancer on Upwork / Photographer
Awarded 2018
Distinguished Expert 2018

Commented:
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 ?.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial