Skip to content

Commit

Permalink
[CorpEmailReport] autoload Exchange 2010 snapin
Browse files Browse the repository at this point in the history
  • Loading branch information
kib committed Oct 23, 2015
1 parent fdcb2aa commit c3cba11
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Get-CorpEmailReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,21 @@

#++++++++++++++++++++++++++++++++++++ Module 2 : Function ++++++++++++++++++++++++++++++++++++


+#Add Exchange 2010 snapin if not already loaded in the PowerShell session
+if (!(Get-PSSnapin | where {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"}))
{
try
{
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction STOP
}
catch
{
Write-Warning $_.Exception.Message
EXIT
}
. $env:ExchangeInstallPath\bin\RemoteExchange.ps1
Connect-ExchangeServer -auto -AllowClobber
}

#region Module 2 : Functions

Expand Down

0 comments on commit c3cba11

Please sign in to comment.