Skip to content

Commit 777d4bf

Browse files
vmsilvamolinaTylerLeonhardt
authored andcommitted
add snippet: Exchange Online connection (#1567)
1 parent 0388343 commit 777d4bf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/community_snippets.md

+23
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ _To contribute, check out our [guide here](#contributing)._
2424
| [DataTable](#datatable) | _Creates a DataTable_ |
2525
| [DateTimeWriteVerbose](#datetimewriteverbose) | _Write-Verbose with the time and date pre-pended to your message by @ThmsRynr_ |
2626
| [Error-Terminating](#error-terminating) | _Create a full terminating error by @omniomi_ |
27+
| [Exchange Online Connection](exchange-online-connection) | _Create a connection to Exchange Online by @vmsilvamolina_ |
2728
| [IfShouldProcess](#ifshouldprocess) | _Added If Should Process_ |
2829
| [MaxColumnLengthinDataTable](#maxcolumnlengthindatatable) | _Gets the max length of string columns in datatables_ |
2930
| [New Azure Resource Group](#new-azure-resource-group) | _Create an Azure Resource group by @vmsilvamolina_ |
@@ -177,6 +178,28 @@ Quickly add a fully defined error record and throw. by @omniomi
177178
}
178179
```
179180

181+
### Exchange Online Connection
182+
183+
Connect to Exchange Online, by @vmsilvamolina
184+
185+
#### Snippet
186+
187+
```json
188+
"Exchange Online Connection": {
189+
"prefix": "ex-ExchangeOnlineConnection",
190+
"body": [
191+
"#Set Execution Policy",
192+
"Set-ExecutionPolicy RemoteSigned -Scope Process",
193+
"#Define credential",
194+
"\\$UserCredential = Get-Credential",
195+
"# Create the session",
196+
"\\$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential \\$UserCredential -Authentication Basic -AllowRedirection",
197+
"Import-PSSession \\$Session -DisableNameChecking"
198+
],
199+
"description": "Connect to Exchange Online"
200+
}
201+
```
202+
180203
### IfShouldProcess
181204

182205
Add If Should Process with easy tab inputs

0 commit comments

Comments
 (0)