{"id":543,"date":"2015-08-18T00:42:27","date_gmt":"2015-08-18T00:42:27","guid":{"rendered":"http:\/\/www.itcrumbs.com\/?p=543"},"modified":"2019-02-07T04:39:44","modified_gmt":"2019-02-07T04:39:44","slug":"connect-to-exchange-online-using-remote-powershell-message-format-for-specific-domain","status":"publish","type":"post","link":"https:\/\/www.itcrumbs.com\/?p=543","title":{"rendered":"Connect to Exchange Online using remote PowerShell &amp; message format for specific domain"},"content":{"rendered":"<p><a title=\"https:\/\/technet.microsoft.com\/en-us\/library\/jj984289(v=exchg.150).aspx\" href=\"https:\/\/technet.microsoft.com\/en-us\/library\/jj984289(v=exchg.150).aspx\">https:\/\/technet.microsoft.com\/en-us\/library\/jj984289(v=exchg.150).aspx<\/a><\/p>\n<p>$UserCredential = Get-Credential <\/p>\n<pre>$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https:\/\/outlook.office365.com\/powershell-liveid\/ -Credential $UserCredential -Authentication Basic -AllowRedirection<\/pre>\n<pre>Import-PSSession $Session<\/pre>\n<pre>{Do work}<\/pre>\n<pre>When done:<\/pre>\n<pre>Remove-PSSession $Session\n**************************************<\/pre>\n<pre>To set mail type for specific domain: <\/pre>\n<pre>New-RemoteDomain -Name &lt;Name of External Domain&gt; \u2013DomainName<\/pre>\n<pre>Set-RemoteDomain -Identity &lt;Name of Domain&gt; -TNEFEnabled $false<\/pre>\n<pre>Get-RemoteDomain -Identity &lt;Name of Domain&gt;| Select TNEFEnabled<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/technet.microsoft.com\/en-us\/library\/jj984289(v=exchg.150).aspx $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https:\/\/outlook.office365.com\/powershell-liveid\/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session {Do work} When done: Remove-PSSession $Session ************************************** To set mail type for specific domain: New-RemoteDomain -Name &lt;Name of External Domain&gt; \u2013DomainName Set-RemoteDomain -Identity &lt;Name of Domain&gt; -TNEFEnabled $false Get-RemoteDomain -Identity &lt;Name of Domain&gt;| Select TNEFEnabled<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-543","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts\/543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=543"}],"version-history":[{"count":2,"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts\/543\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=\/wp\/v2\/posts\/543\/revisions\/545"}],"wp:attachment":[{"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itcrumbs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}