File tree 1 file changed +12
-7
lines changed
EXCHANGE-Connect-ExchangeOnPremises
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,18 @@ function Connect-ExchangeOnPremises {
35
35
[System.Management.Automation.Credential ()]
36
36
$Credential = [System.Management.Automation.PSCredential ]::Empty
37
37
)
38
+ try {
38
39
39
- $Splatting = @ {
40
- ConnectionUri = $ConnectionUri
41
- ConfigurationName = ' microsoft.exchange'
42
- }
43
- IF ($PSBoundParameters [' Credential' ]) { $Splatting.Credential = $Credential }
44
40
45
- # Load Exchange cmdlets (Implicit remoting)
46
- Import-PSSession - Session (New-PSSession @Splatting )
41
+ $Splatting = @ {
42
+ ConnectionUri = $ConnectionUri
43
+ ConfigurationName = ' microsoft.exchange'
44
+ }
45
+ IF ($PSBoundParameters [' Credential' ]) { $Splatting.Credential = $Credential }
46
+
47
+ # Load Exchange cmdlets (Implicit remoting)
48
+ Import-PSSession - Session (New-PSSession @Splatting )
49
+ }catch {
50
+ $PSCmdlet.ThrowTerminatingError ($_ )
51
+ }
47
52
}
You can’t perform that action at this time.
0 commit comments