tag:blogger.com,1999:blog-36379029759423672732024-03-17T20:04:14.010-07:00SysAdmin BlogOffice 365, SharePoint on-prem, System Center Configuration Manager, Windows, and much more!Goodies Druidhttp://www.blogger.com/profile/06986117902296052054noreply@blogger.comBlogger212125tag:blogger.com,1999:blog-3637902975942367273.post-44891024540011950002023-08-22T12:26:00.004-07:002023-08-24T06:24:38.592-07:00Copy a Distribution Group to an M365 Group using Power Automate<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFco92zJxOR2b-mU1SgnBwr8Szy_vh-Kg1unRD4C0TDaoTFHG-kZIE_-g7FrRA1aq_FvenSzJ8mwZlQaeoWh3EN0AQsr56V-2Ne2iMndKVxxBTuRz2nxdgjhDnUx3VugYt7xCJqfly_8EZ0H692gQ4kNF6fkwYIb8RCHHi2yLB0AeNOpCyXHIlb09dGk4O/s600/PowerAutomate.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="600" data-original-width="600" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFco92zJxOR2b-mU1SgnBwr8Szy_vh-Kg1unRD4C0TDaoTFHG-kZIE_-g7FrRA1aq_FvenSzJ8mwZlQaeoWh3EN0AQsr56V-2Ne2iMndKVxxBTuRz2nxdgjhDnUx3VugYt7xCJqfly_8EZ0H692gQ4kNF6fkwYIb8RCHHi2yLB0AeNOpCyXHIlb09dGk4O/s320/PowerAutomate.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">I was asked if it was possible to synchronize an Exchange Online Distribution Group members to an M365 Group. There's nothing that natively does this, but I'm going to show you how i used Power Automate to sync members from one to the other.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Before you start, <a href="https://www.sharepointdiary.com/2020/10/how-to-disable-welcome-email-in-office-365-group.html" target="_blank">make sure the welcome emails are turned off in the receiving M365 group</a>, so that each time you wipe the group and add members to it, your users aren't getting spammed with emails.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><div class="line number1 index0 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="powershell comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">#Parameters</code></div><div class="line number2 index1 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="powershell variable" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(170, 119, 0) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">$GroupId</code> <code class="powershell plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">= </code><code class="powershell string" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">"hrteam@CrescentIntranet.com"</code></div><div class="line number3 index2 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"> </div><div class="line number4 index3 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="powershell comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">#Connect to Exchange Online</code></div><div class="line number5 index4 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="powershell functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">Connect-ExchangeOnline</code> <code class="powershell color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: gray !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">-Credential</code> <code class="powershell plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">(</code><code class="powershell functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">Get-Credential</code><code class="powershell plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">)</code></div><div class="line number6 index5 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"> </div><div class="line number7 index6 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="powershell comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">#Disable the Group Welcome Message Email</code></div><div class="line number8 index7 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #212121; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 15px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="powershell functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">Set-UnifiedGroup</code> <code class="powershell color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: gray !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">-Identity</code> <code class="powershell variable" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(170, 119, 0) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">$GroupId</code> <code class="powershell color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: gray !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">-UnifiedGroupWelcomeMessageEnabled</code><code class="powershell plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">:</code><code class="powershell variable" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(170, 119, 0) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1em !important; font-stretch: inherit; font-variant: inherit; font-variation-settings: inherit; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: inherit; width: auto !important;">$false</code></div></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Now, let's create the flow:</div><div class="separator" style="clear: both; text-align: left;"><ol style="text-align: left;"><li>Start with a blank Flow, and make the trigger be a Recurrence trigger. Make it run as often as you want to sync.</li><li>Create two string variables. </li><ol><li>One to hold the Object ID of the Distribution Group (varDistroGroupID)</li><li>the other to hold the Object ID of the M365 Group (varM365GroupID). </li></ol><li>Then from the Office 365 Groups connectors, add a "Send an HTTP request V2". </li><ol><li>URI: <span style="background-color: #fcff01;">https://graph.microsoft.com/v1.0/groups/@{variables('varDistroGroupID')}/transitiveMembers?$top=999</span></li><li>Method: GET</li><li>Content-Type: application/json</li></ol><li>Add a Filter Array next</li><ol><li>From: <span style="background-color: #fcff01;">body('Send_an_HTTP_request_V2')['value']</span></li><li><span style="background-color: #fcff01;">item()?['@.odata.type']</span> is equal to <span style="background-color: #fcff01;">#microsoft.graph.user</span></li></ol><li>Add a Parse JSON next</li><ol><li>Content: body('Filter_array')</li><li>Schema:</li><ol><li><div style="background-color: #fffffe; font-family: Consolas, "Courier New", monospace; font-size: 13px; line-height: 18px; white-space: pre;"><div>{</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"array"</span>,</div><div> <span style="color: #a31515;">"items"</span>: {</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"object"</span>,</div><div> <span style="color: #a31515;">"properties"</span>: {</div><div> <span style="color: #a31515;">"@@odata.type"</span>: {</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"string"</span></div><div> },</div><div> <span style="color: #a31515;">"id"</span>: {</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"string"</span></div><div> },</div><div> <span style="color: #a31515;">"displayName"</span>: {</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"string"</span></div><div> },</div><div> <span style="color: #a31515;">"mail"</span>: {</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"string"</span></div><div> },</div><div> <span style="color: #a31515;">"userPrincipalName"</span>: {</div><div> <span style="color: #a31515;">"type"</span>: <span style="color: #0451a5;">"string"</span></div><div> }</div><div> },</div><div> <span style="color: #a31515;">"required"</span>: [</div><div> <span style="color: #0451a5;">"@@odata.type"</span>,</div><div> <span style="color: #0451a5;">"id"</span>,</div><div> <span style="color: #0451a5;">"displayName"</span>,</div><div> <span style="color: #0451a5;">"mail"</span>,</div><div> <span style="color: #0451a5;">"userPrincipalName"</span></div><div> ]</div><div> }</div><div>}</div></div></li></ol></ol><li>Add a List Group Members and for the ID use varM365GroupID</li><li>Next we are going to remove all members of the M365 group</li><ol><li>From the Office 365 Groups connectors, add the Remove Member from Group. Use varM365groupID, and for the User Principal Name use UPN you got from the previous step.</li></ol><li>Then you're going to add the members of the distribution group to the M365 group by using a "Add Member to Group" action from the Office 365 Groups connectors.</li><ol><li>Group Id: varM365GroupID</li><li>User Principal Name: userPrincipalName from the Parse JSON step.</li></ol></ol><div>I recommend you test this on a testing M365 group, because you don't want to erase your prod data before you know if it works correctly!</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgyrQpnWO4QCD1lpjkigaPD7v_yKJY_6x9JO6Ott6Iun4SnOXpwEO-bVqQZ6eCoVxsIp_PX1XMry5qmOA997_AmL9ingLGibaKFE5p506L3DINZ0-MlE2hdO1Ztx1YgF1CLsLiiyKl6xPnHtq2b1DkT2qkxCe_B3v8iop9hpVOHhNAlxQfA82S9x7I9Ac1/s798/Sync%20Distribution%20Group%20to%20M365%20Group%201.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="798" data-original-width="616" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgyrQpnWO4QCD1lpjkigaPD7v_yKJY_6x9JO6Ott6Iun4SnOXpwEO-bVqQZ6eCoVxsIp_PX1XMry5qmOA997_AmL9ingLGibaKFE5p506L3DINZ0-MlE2hdO1Ztx1YgF1CLsLiiyKl6xPnHtq2b1DkT2qkxCe_B3v8iop9hpVOHhNAlxQfA82S9x7I9Ac1/w494-h640/Sync%20Distribution%20Group%20to%20M365%20Group%201.jpg" width="494" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhDs6CjYlu6l34YanFmUw4j5qgoJU9i3RfzyTczf0EDslWxN6stdRLgDfAKUpCKxDjUv0YK6CwY95iMm_SozzjRbigWj2xXczOHGIFo2zLrFcOX1koA5q0hFr0h9oBGME3YTWQKkQhs_sPOLommXfnmjJnA32PrU93n-K9gEzqK7rtSixCXn0JTkhBkYcJ/s623/Sync%20Distribution%20Group%20to%20M365%20Group%202.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="600" data-original-width="623" height="616" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhDs6CjYlu6l34YanFmUw4j5qgoJU9i3RfzyTczf0EDslWxN6stdRLgDfAKUpCKxDjUv0YK6CwY95iMm_SozzjRbigWj2xXczOHGIFo2zLrFcOX1koA5q0hFr0h9oBGME3YTWQKkQhs_sPOLommXfnmjJnA32PrU93n-K9gEzqK7rtSixCXn0JTkhBkYcJ/w640-h616/Sync%20Distribution%20Group%20to%20M365%20Group%202.jpg" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiZC4266AYZRgAPd7S8P4rRdS0k3mphpbQ6ew42Vg0TGLy74o4LoSo-XB9U-74Z39CgJqVm9OMFQ6lwXGj1kUjsZC3eyWzNRWr1uIgNYhnufKftrzao1MpIEXLEAUlNrvxPcPor5uTKK4XfADeLar_ZD7lkftbPhwzvjvEy8wsfMSk_nZSYt9yKYq-uewp/s753/Sync%20Distribution%20Group%20to%20M365%20Group%203.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="753" data-original-width="656" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiZC4266AYZRgAPd7S8P4rRdS0k3mphpbQ6ew42Vg0TGLy74o4LoSo-XB9U-74Z39CgJqVm9OMFQ6lwXGj1kUjsZC3eyWzNRWr1uIgNYhnufKftrzao1MpIEXLEAUlNrvxPcPor5uTKK4XfADeLar_ZD7lkftbPhwzvjvEy8wsfMSk_nZSYt9yKYq-uewp/w558-h640/Sync%20Distribution%20Group%20to%20M365%20Group%203.jpg" width="558" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div>Sources:</div><div class="separator" style="clear: both; text-align: left;"><ul style="text-align: left;"><li><a href="https://techcommunity.microsoft.com/t5/microsoft-365-groups/ms-grapah-api-returns-only-100-office-365-groups/m-p/238470">MS Grapah API returns only 100 Office 365 groups - Microsoft Community Hub</a></li><li><a href="https://learn.microsoft.com/en-us/graph/api/group-list-transitivemembers?view=graph-rest-1.0&tabs=http#code-try-1">List group transitive members - Microsoft Graph v1.0 | Microsoft Learn</a></li><li><a href="https://powerusers.microsoft.com/t5/Using-Flows/PowerAutomate-Loop-through-an-AAD-Security-Group-to-find-all/td-p/1742889#:~:text=You%20could%20use%20the%20List%20group%20transitive%20members,you%20can%20make%20sure%20it%20only%20outputs%20users.">Solved: PowerAutomate Loop through an AAD Security Group t... - Power Platform Community (microsoft.com)</a></li><li><a href="https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Comparing-the-members-of-a-distribution-list-to-the-members-of/ba-p/758533">Comparing the members of a distribution list to th... - Power Platform Community (microsoft.com)</a></li><li><a href="https://www.sharepointdiary.com/2020/10/how-to-disable-welcome-email-in-office-365-group.html">Office 365 Group: How to Disable Welcome Email for new members? - SharePoint Diary</a></li></ul><div><br /></div></div><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-31413350272887414852023-07-26T06:33:00.004-07:002023-07-26T06:33:30.681-07:00Add/Remove members from a Teams custom App Permission Policy and Setup Policy using PowerShell<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4sAs0LSPwXElbvzAEh-_c_hxxMhWQbFVjeKFvcG56NqK4XXm9x4FZiV4Bjf988xNC7n3IU5SoC07jhZ7n8_9ZvFv2cDjolKyoZKfQJDJvfG5oAM__uxyB7-ao0GgHo581_kwysZSNeEfeAgDHhi5Ei1DDeU_Fmb6SmrsJbuMOQVj7LLh4gHPBr-2BsfrZ/s909/teamsheader.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="511" data-original-width="909" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4sAs0LSPwXElbvzAEh-_c_hxxMhWQbFVjeKFvcG56NqK4XXm9x4FZiV4Bjf988xNC7n3IU5SoC07jhZ7n8_9ZvFv2cDjolKyoZKfQJDJvfG5oAM__uxyB7-ao0GgHo581_kwysZSNeEfeAgDHhi5Ei1DDeU_Fmb6SmrsJbuMOQVj7LLh4gHPBr-2BsfrZ/s320/teamsheader.jpg" width="320" /></a></div><br />This script will add or remove members from a Teams App Permission Policy and an App Setup Policy using PowerShell. You will need to change the names of the policies in the variables, and for assigning members you will need the Group Object ID so that you can assign the policy to the group members.<p></p><p>The blocks are commented out, so that you can highlight the code block and run the assign or unassign script separately of each other.</p><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt;">Connect-MicrosoftTeams<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> <br /></span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$AppPermissionPolicy</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"</span><span style="background-color: #fcff01; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">Custom App Policy Name</span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"<br /></span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$AppSetupPolicy</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"</span><span style="background-color: #fcff01; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">Custom App Setup Policy Name</span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> <br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;"><# --------------------- Assign Policies to
Users in an AAD Group -----------------------<br /></span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$GroupObjectId</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt;"><span style="background-color: white;">"</span><span style="background-color: #fcff01;">00000000-0000-0000-0000-000000000000</span><span style="background-color: white;">"</span><br /><span style="background-color: white;"><o:p></o:p></span></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> <br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">$GroupMembers = Get-AzureADGroupMember -ObjectId
$GroupObjectId -All $true | select UserPrincipalName<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">$GroupMembers | ForEach {<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">
Grant-CsTeamsAppPermissionPolicy -Identity $_.UserPrincipalName
-PolicyName $AppPermissionPolicy<br /> </span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">
Grant-CsTeamsAppSetupPolicy -Identity $_.UserPrincipalName -PolicyName
$AppSetupPolicy<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">#--------------------------------------------------------------------------------------#><br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> <br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> <br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;"><# --------------------- Remove App Permission P</span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">olicy from
Users ------------------------</span></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">"TeamsAppPermissionPolicy
-eq '</span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$AppPermissionPolicy</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">'"<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$GroupMembers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Get-CsOnlineUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Select</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">UserPrincipalName<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$GroupMembers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">ForEach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">#New-CsBatchPolicyAssignmentOperation -PolicyType
TeamsAppPermissionPolicy -PolicyName $null -Identity $_.UserPrincipalName
-OperationName "Batch unassign $($AppPermissionPolicy) app permission
policy"<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Grant-CsTeamsAppPermissionPolicy</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Identity</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">UserPrincipalName </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-PolicyName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$null<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">#--------------------------------------------------------------------------------------#> </span></div><div><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;"><br /></span></div><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;"><br /></span></div><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;"><# --------------------- Remove App Setup P</span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt;">olicy from Users -----------------------------</span></div></div><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">"TeamsAppSetupPolicy
-eq '</span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$AppSetupPolicy</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">'"<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$GroupMembers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Get-CsOnlineUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Select</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">UserPrincipalName<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$GroupMembers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">ForEach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">#New-CsBatchPolicyAssignmentOperation -PolicyType
TeamsAppSetupPolicy -PolicyName $null -Identity $_.UserPrincipalName
-OperationName "Batch unassign $($AppPermissionPolicy) app setup
policy"<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Grant-CsTeamsAppSetupPolicy</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Identity</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">UserPrincipalName </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-PolicyName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$null<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">#--------------------------------------------------------------------------------------#> </span></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;"><br /></span></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;"><br /></span></div><p>
</p><p>Sources:</p><p></p><ul style="text-align: left;"><li><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 12px;"><a href="https://learn.microsoft.com/en-us/powershell/module/teams/new-csbatchpolicyassignmentoperation?view=teams-ps">https://learn.microsoft.com/en-us/powershell/module/teams/new-csbatchpolicyassignmentoperation?view=teams-ps</a> </span></li></ul><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-7924619149634705802023-07-25T10:34:00.005-07:002023-07-25T10:34:40.269-07:00PowerShell to grant access to a Power BI Workspace<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpalo9DFpo38k4TAtP5eGwF6l4ZLjsMoJsYkpaze2LsbK3lF1Q2Gy4k43Zh4g6yZppjwLKOktodsWUpnDpedbqVHDNdw_jW5qYDQalbt7moOtHC9eMsUvW_Nhzd7NZTITd7DeYhmAiQpOhoM_d8eZ2M8ERjYdEk91DjbnNO9z_AAL6FvuddoQfeBZUsUQD/s1900/pbi%20banner.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="1900" height="124" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpalo9DFpo38k4TAtP5eGwF6l4ZLjsMoJsYkpaze2LsbK3lF1Q2Gy4k43Zh4g6yZppjwLKOktodsWUpnDpedbqVHDNdw_jW5qYDQalbt7moOtHC9eMsUvW_Nhzd7NZTITd7DeYhmAiQpOhoM_d8eZ2M8ERjYdEk91DjbnNO9z_AAL6FvuddoQfeBZUsUQD/s320/pbi%20banner.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">This short script will help you get access to a Power BI workspace. All you need is the user's email address, and the ID of the workspace which you can get from the URL. The last two lines get information about the Workspace, and confirm that you granted access to the user.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><p></p><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Import-Module</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Name</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">MicrosoftPowerBIMgmt<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Connect-PowerBIServiceAccount<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$workspaceID</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$email</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">"person@contoso.com"<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;"> <br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Add-PowerBIWorkspaceUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Scope</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Organization</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Id</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$workspaceID</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-UserEmailAddress</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$email</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-AccessRight</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Member<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Get-PowerBIWorkspace</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Id</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$workspaceID<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Invoke-PowerBIRestMethod</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Url</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">"groups/</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">$workspaceID</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">/users"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">-Method</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-font-kerning: 0pt;">Get </span></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-80792620652164021352023-07-21T06:38:00.003-07:002023-07-21T06:38:49.743-07:00Teams PowerShell - Assign an app permission policy and app setup policy to AD group members<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EOw9L5QCArbOEcZmPgJueH4qpzN4BUG4tSRqBW4VTGfB2YMv0O7uFFl1gNRbtC9qdlvAstRqPtAL4IT9VHEukQNZ2VgqpXqfaMLugpjaZPHhljyEXnVR9a4UMQm8Pw7ofEzqKnBb3qNz_Nm2MKndQucU8xPXXC3h-qND73n8zJUylS0fSQPBraqaMQDi/s909/teamsheader.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="511" data-original-width="909" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EOw9L5QCArbOEcZmPgJueH4qpzN4BUG4tSRqBW4VTGfB2YMv0O7uFFl1gNRbtC9qdlvAstRqPtAL4IT9VHEukQNZ2VgqpXqfaMLugpjaZPHhljyEXnVR9a4UMQm8Pw7ofEzqKnBb3qNz_Nm2MKndQucU8xPXXC3h-qND73n8zJUylS0fSQPBraqaMQDi/s320/teamsheader.jpg" width="320" /></a></div><br /><p></p><p>This is a PowerShell script I wrote to take an Azure AD group and assign the members a Teams App Permission policy and a Teams App Setup Policy. First, look up the group's Object ID in Azure AD, and then replace it in the script below.</p><p>You will also need to replace the policy names with the policies you want to assign.</p><p></p><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="font-size: x-small;"><span style="background-color: white; font-family: courier;"><span style="color: blue;">Connect-MicrosoftTeams<br /></span></span><o:p style="background-color: white;"><span style="font-family: courier;"> <br /></span></o:p><span style="font-family: courier;"><span style="background-color: white; color: #a82d00;">$GroupObjectId</span><span style="background-color: white; color: dimgrey;">=</span><span style="color: darkred;"><span style="background-color: white;">"</span><span style="background-color: #fcff01;">00000000-0000-0000-0000-000000000000</span><span style="background-color: white;">"</span><br /></span></span><span style="background-color: white; font-family: courier;"><span style="color: #a82d00;">$GroupMembers</span><span style="color: black;"> </span><span style="color: dimgrey;">=</span><span style="color: black;"> </span><span style="color: blue;">Get-AzureADGroupMember</span><span style="color: black;"> </span><span style="color: navy;">-ObjectId</span><span style="color: black;"> </span><span style="color: #a82d00;">$GroupObjectId</span><span style="color: black;"> </span><span style="color: navy;">-All</span><span style="color: black;"> </span><span style="color: #a82d00;">$true</span><span style="color: black;"> </span><span style="color: dimgrey;">|</span><span style="color: black;"> </span><span style="color: blue;">select</span><span style="color: black;"> </span><span style="color: blueviolet;">UserPrincipalName<br /></span></span><o:p style="background-color: white;"><span style="font-family: courier;"> <br /></span></o:p><span style="background-color: white; font-family: courier;"><span style="color: #a82d00;">$GroupMembers</span><span style="color: black;"> </span><span style="color: dimgrey;">|</span><span style="color: black;"> </span><span style="color: blue;">ForEach</span><span style="color: black;"> {<br /></span></span><span style="font-family: courier;"><span style="background-color: white; color: black;"><span style="mso-spacerun: yes;"> </span></span><span style="background-color: white; color: blue;">Grant-CsTeamsAppPermissionPolicy</span><span style="background-color: white; color: black;"> </span><span style="background-color: white; color: navy;">-Identity</span><span style="background-color: white; color: black;"> </span><span style="background-color: white; color: #a82d00;">$_</span><span style="background-color: white; color: dimgrey;">.</span><span style="background-color: white; color: black;">UserPrincipalName </span><span style="background-color: white; color: navy;">-PolicyName</span><span style="background-color: white; color: black;"> </span><span style="color: darkred;"><span style="background-color: white;">"</span><span style="background-color: #fcff01;">App Permission Policy Name</span><span style="background-color: white;">"</span><br /></span></span><span style="font-family: courier;"><span style="background-color: white; color: black;"><span style="mso-spacerun: yes;"> </span></span><span style="background-color: white; color: blue;">Grant-CsTeamsAppSetupPolicy</span><span style="background-color: white; color: black;"> </span><span style="background-color: white; color: navy;">-Identity</span><span style="background-color: white; color: black;"> </span><span style="background-color: white; color: #a82d00;">$_</span><span style="background-color: white; color: dimgrey;">.</span><span style="background-color: white; color: black;">UserPrincipalName </span><span style="background-color: white; color: navy;">-PolicyName</span><span style="background-color: white; color: black;"> </span><span style="color: darkred;"><span style="background-color: white;">"</span><span style="background-color: #fcff01;">App Setup Policy Name</span><span style="background-color: white;">"</span><br /></span></span><span style="background-color: white; color: black;"><span style="font-family: courier;">} </span></span></span></div>
<br /><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-56844476147566881852023-06-20T13:13:00.005-07:002023-06-20T13:16:29.011-07:00Quickly remove all navigation from a classic SharePoint Online page.<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRvkhvvuel0a-D1l7Y5zdekdnGp7PviRuXRW1B83rxD6QB7exxvQwCUXgHVoZF7OzuRGwKDur-coqhnoAGX8ZJMzQtipokihvj-9ylvNAMLkHBguDkISa038J6AgKDwqjWpUk8ykrvJ2f52hw4lJAXh-3c-LvPoMz-AL8sDFa-GNzWwZdEfjnjBTIN09zC/s614/Logo-Final-Sharepoint-1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRvkhvvuel0a-D1l7Y5zdekdnGp7PviRuXRW1B83rxD6QB7exxvQwCUXgHVoZF7OzuRGwKDur-coqhnoAGX8ZJMzQtipokihvj-9ylvNAMLkHBguDkISa038J6AgKDwqjWpUk8ykrvJ2f52hw4lJAXh-3c-LvPoMz-AL8sDFa-GNzWwZdEfjnjBTIN09zC/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;">If you want to quickly remove the side and top navigation from a SharePoint Online classic page to make the content full page, add a script editor webpart, and put this CSS into it:</div><div class="separator" style="clear: both; text-align: left;"><br /></div><p></p><div class="separator" style="clear: both;"><style></div><div class="separator" style="clear: both;"><div class="separator" style="clear: both;">#s4-titlerow </div><div class="separator" style="clear: both;">{</div><div class="separator" style="clear: both;"> margin: 0px; </div><div class="separator" style="clear: both;"> padding: 0px; </div><div class="separator" style="clear: both;"> width: 0px; </div><div class="separator" style="clear: both;"> height: 0px; </div><div class="separator" style="clear: both;"> visibility: hidden;</div><div class="separator" style="clear: both;">}</div><div class="separator" style="clear: both;">#sideNavBox, #contentBox > #DeltaPageStatusBar, #contentBox > #notificationArea, #contentBox > #mainContent {display: none;}</div><div class="separator" style="clear: both;">#contentBox { margin-left: 0px; margin-top: 0px; width:100%;}</div><div class="separator" style="clear: both;"></style></div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">If your script editor web part is missing, run this powershell script to make it show up:</div><div class="separator" style="clear: both;">Set-SPOsite -Identity "https://contoso.sharepoint.com/sites/testsite" -DenyAddAndCustomizePages 0</div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;"><u>Resources</u>:</div><div class="separator" style="clear: both;"><ul style="text-align: left;"><li><a href="https://sharepoint.stackexchange.com/questions/241119/hide-s4-titlerow-show-search-box">sharepoint online - hide s4-titlerow show search box - SharePoint Stack Exchange</a></li><li><a href="https://blog.jussipalo.com/2012/03/sharepoint-hide-left-navigation.html">How To Code: SharePoint: Hide left navigation (jussipalo.com)</a></li></ul></div></div><p><br /></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-92015194217327085872023-04-12T06:21:00.001-07:002023-04-12T06:21:17.659-07:00Change a Power BI CSV or Excel Datasource from File Server to SharePoint Online<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7h8gttiZW-TmCkMObstN5D3uW_DryPKai72ijJwrkriuf2wQsuVweeg-Iy8Vo5r3GsQPWNf2VtLE9T5AmPssj7F4STdgw4Sd6knEsC91J4Jm_N3VCrLJDDUWZzL3skgdRhiy10-xKdGL478B4SyuYhDfmnnqksKLU7XHWVu_9qdfxYXB6glCgc5Wgow/s1900/pbi%20banner.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="1900" height="124" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7h8gttiZW-TmCkMObstN5D3uW_DryPKai72ijJwrkriuf2wQsuVweeg-Iy8Vo5r3GsQPWNf2VtLE9T5AmPssj7F4STdgw4Sd6knEsC91J4Jm_N3VCrLJDDUWZzL3skgdRhiy10-xKdGL478B4SyuYhDfmnnqksKLU7XHWVu_9qdfxYXB6glCgc5Wgow/s320/pbi%20banner.jpg" width="320" /></a></div><br /><p></p><p>I've recently had some Power BI reports that reference Excel and CSV files stored on a file server as data sources. To get around using an on-prem data gateway, I changed the source of the file to be in a SharePoint Online document library. Here is how I did that:</p><p>1) Open the report and open Power Query Editor by clicking the Transform Data button.</p><p>2) Right click on the query you want to change, and select Advanced Editor</p><p>3) Copy the entire query to a notepad file for later (you don't need to save it)</p><p>4) Replace the entire query with this (replacing the URL of the site with your site), and click Done</p><div style="text-align: left;"><div><span style="font-family: courier; font-size: x-small;">let</span></div><div><span style="font-family: courier; font-size: x-small;"> Source = SharePoint.Contents("https://contoso.sharepoint.com/sites/ReportSite/", [ApiVersion = 15])</span></div><div><span style="font-family: courier; font-size: x-small;">in</span></div><div><span style="font-family: courier; font-size: x-small;"> Source</span></div><div><br /></div><div>5) Navigate to the file that you want (make sure that you've copied the original source file from the file server to a SharePoint document library first), by clicking in the Content column. Click Table to navigate folders, and click Binary when you get to the file you want to pull in.</div><div><br /></div><div>6) Right click the query again, and select Advanced Editor</div><div><br /></div><div>7) It should now have added four or more rows to the query. Here is an example:</div><div><div><span style="font-size: x-small;">let</span></div><div><span style="font-size: x-small;"> Source = SharePoint.Contents("https://contoso.sharepoint.com/sites/ReportSite/", [ApiVersion = 15]),</span></div><div><span style="font-size: x-small;"> DashboardFiles = Source{[Name="DashboardFiles"]}[Content],</span></div><div><span style="font-size: x-small;"> #"data csv" = DashboardFiles{[Name="data.csv"]}[Content],</span></div><div><span style="font-size: x-small;"> #"Imported CSV" = Csv.Document(#"data csv",[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.None]),</span></div><div><span style="font-size: x-small;"> #"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true]),</span></div><div><span style="font-size: x-small;"> #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Device Name", type text}, {"Duration (In Seconds)", Int64.Type}, {"StartTime", type datetime}, {"EndTime", type datetime}, {"PeopleCount", type text}, {"Device Id", type text}})</span></div><div><span style="font-size: x-small;">in</span></div><div><span style="font-size: x-small;"> #"Changed Type"</span></div></div><div>Your query will look slightly different than this based on your names and whether you are using a CSV or XLSX spreadsheet.</div><div><br /></div><div>8) add a comma at the end of the "#"Changed Type" = " line.</div><div><br /></div><div>9) Go to your notepad and find the first instance of Changed Type in your query. Select and copy everything below it.</div><div><br /></div><div>10) In the advanced query editor, paste it below the last entry in the query, replacing the "in #"Changed Type""</div><div><br /></div><div>11) Click Done and you have successfully changed the data source to a spreadsheet sitting in SharePoint Online.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg89N0iEjqs2qGOgp74E-UR9OrtgMY5wyaK1196FuAc64nOFmxpoCY6dWq0-mdoTve-dqb0BBh1O3DON3e5OJOq4rF-h_wDwa1gzHLK3l2ERClozuU4TWZxYAoeJAh0N2WAn-t8yMIKmL3ZCPsUV3Ow8gnxc05go00mckn4-ZnQgYrXOZRIs_ZHhIgMg/s1010/Change%20a%20Power%20BI%20Datasource%20from%20File%20Server%20to%20SharePoint%20Online.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="758" data-original-width="1010" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg89N0iEjqs2qGOgp74E-UR9OrtgMY5wyaK1196FuAc64nOFmxpoCY6dWq0-mdoTve-dqb0BBh1O3DON3e5OJOq4rF-h_wDwa1gzHLK3l2ERClozuU4TWZxYAoeJAh0N2WAn-t8yMIKmL3ZCPsUV3Ow8gnxc05go00mckn4-ZnQgYrXOZRIs_ZHhIgMg/w640-h480/Change%20a%20Power%20BI%20Datasource%20from%20File%20Server%20to%20SharePoint%20Online.jpg" width="640" /></a></div><br /><div><br /></div></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-58246479751175990802023-03-28T12:57:00.004-07:002023-03-28T12:57:38.781-07:00Get the full names of all fields in a SharePoint list<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7n0MjN4fRhdIJ1AZEnsHHWDsTn7Ed3i2iDVxEMtsil0TW5JuZrNBKsvoaThF71CRp7C0a9xQoYgQyuPsZB-CxQgn7lX-Lx7VLsI7Tj5o5VyLJXTnFMVMRAAd3D7ZpwQOEkJeSx81WMhiFyMvttwTp78YRYvjeCu-gK04mN3jJ0VLtPIZwixpzLwnGZg/s614/Logo-Final-Sharepoint-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7n0MjN4fRhdIJ1AZEnsHHWDsTn7Ed3i2iDVxEMtsil0TW5JuZrNBKsvoaThF71CRp7C0a9xQoYgQyuPsZB-CxQgn7lX-Lx7VLsI7Tj5o5VyLJXTnFMVMRAAd3D7ZpwQOEkJeSx81WMhiFyMvttwTp78YRYvjeCu-gK04mN3jJ0VLtPIZwixpzLwnGZg/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div><br /><p></p><p>PowerShell script that pulls all the field info of a SharePoint Online list. It's good for when you're scripting and don't know the names of all the fields.</p><p></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-PnPListItem</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Id</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">55</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-List</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"M365
License Audit"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Fields</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$global:FieldsList</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Select</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-ExpandProperty</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">FieldValues</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Format-List</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">*
<o:p></o:p></span></p><br /><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-30961902592904936922023-03-28T12:55:00.002-07:002023-03-28T12:55:31.635-07:00PowerShell - Add and Remove users from Active Directory Groups<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoToOVcLaBLOCUam6ZwwlIP_i37dS13IXrKnMYc7iEjRmrIUKHupvEa9itxrw1-NPQjh4CfVYzODmPnDKJVl97tEu1hv41krWRM5o2MuRyBBYMjaOuKr2Pc3-_nrbROhbSN-GMbDm8L25UitYVsjp6JzZg4mWbRzHIPi1rAFuDx0dCJKpWKZv6Yg54lw/s937/active-directory-logo-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="937" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoToOVcLaBLOCUam6ZwwlIP_i37dS13IXrKnMYc7iEjRmrIUKHupvEa9itxrw1-NPQjh4CfVYzODmPnDKJVl97tEu1hv41krWRM5o2MuRyBBYMjaOuKr2Pc3-_nrbROhbSN-GMbDm8L25UitYVsjp6JzZg4mWbRzHIPi1rAFuDx0dCJKpWKZv6Yg54lw/s320/active-directory-logo-1.png" width="320" /></a></div><br /><p></p><p>PowerShell script to add and remove users from active directory groups on-prem</p><div style="text-align: left;"><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#import the ActiveDirectory Module</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Import-Module</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">ActiveDirectory</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> @(</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Emily.Jones@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Max.Wilson@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Olivia.Davis@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Ethan.Lee@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Ava.Thompson@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Lucas.Garcia@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Mia.Patel@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Benjamin.Taylor@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Isabella.Nguyen@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Alexander.Johnson@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">){</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#PowerShellRemoveE3</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Remove-ADGroupMember</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Identity</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Office365_F3'</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Members</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> (</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-ADUser</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Filter</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"userPrincipalName
-eq '</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Select</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-expand</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Name</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">) </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-confirm:</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$false</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#PowerShellAddF3</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-ADGroupMember</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Identity</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Office365-E3'</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Members</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> (</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-ADUser</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Filter</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"userPrincipalName
-eq '</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Select</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-expand</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Name</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">} </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><br /></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-17040637580865398412023-03-28T12:53:00.001-07:002023-03-28T12:53:02.865-07:00Powershell add items to a SharePoint Online list<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7n0MjN4fRhdIJ1AZEnsHHWDsTn7Ed3i2iDVxEMtsil0TW5JuZrNBKsvoaThF71CRp7C0a9xQoYgQyuPsZB-CxQgn7lX-Lx7VLsI7Tj5o5VyLJXTnFMVMRAAd3D7ZpwQOEkJeSx81WMhiFyMvttwTp78YRYvjeCu-gK04mN3jJ0VLtPIZwixpzLwnGZg/s614/Logo-Final-Sharepoint-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7n0MjN4fRhdIJ1AZEnsHHWDsTn7Ed3i2iDVxEMtsil0TW5JuZrNBKsvoaThF71CRp7C0a9xQoYgQyuPsZB-CxQgn7lX-Lx7VLsI7Tj5o5VyLJXTnFMVMRAAd3D7ZpwQOEkJeSx81WMhiFyMvttwTp78YRYvjeCu-gK04mN3jJ0VLtPIZwixpzLwnGZg/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div><br /><p></p><div style="text-align: left;">A quick script to add items to a SharePoint list:</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Import-Module</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">PnP.Powershell</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<div style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; text-align: left;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">https://contoso.sharepoint.com/sites/test</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Interactive</span></div>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @(</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Emily.Jones@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Max.Wilson@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Olivia.Davis@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Ethan.Lee@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Ava.Thompson@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Lucas.Garcia@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Mia.Patel@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Benjamin.Taylor@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Isabella.Nguyen@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'Alexander.Johnson@contoso.com'</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;">
</p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$upn</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-PnPListItem</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-List</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"License Audit"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Values</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @{</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Title"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$upn</span><span style="font-family: "Lucida Console"; font-size: 9pt;">; </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Keep_x0020_License"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"No"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">; </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Notes"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Imported
from PowerShell"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">} </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p></div><p><br /></p><p><br /></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-79419066770427534942023-03-28T12:30:00.002-07:002023-03-28T12:30:11.624-07:00Create a SharePoint Online site map using PowerShell<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7n0MjN4fRhdIJ1AZEnsHHWDsTn7Ed3i2iDVxEMtsil0TW5JuZrNBKsvoaThF71CRp7C0a9xQoYgQyuPsZB-CxQgn7lX-Lx7VLsI7Tj5o5VyLJXTnFMVMRAAd3D7ZpwQOEkJeSx81WMhiFyMvttwTp78YRYvjeCu-gK04mN3jJ0VLtPIZwixpzLwnGZg/s614/Logo-Final-Sharepoint-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7n0MjN4fRhdIJ1AZEnsHHWDsTn7Ed3i2iDVxEMtsil0TW5JuZrNBKsvoaThF71CRp7C0a9xQoYgQyuPsZB-CxQgn7lX-Lx7VLsI7Tj5o5VyLJXTnFMVMRAAd3D7ZpwQOEkJeSx81WMhiFyMvttwTp78YRYvjeCu-gK04mN3jJ0VLtPIZwixpzLwnGZg/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div>Here is a PowerShell script that utilizes the SharePoint PnP, which will create a list of the subsites of a SharePoint site, creating a crude site map.<div><br /></div><div><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Net.ServicePointManager</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console"; font-size: 9pt;">SecurityProtocol
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Net.SecurityProtocolType</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Tls </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-bor</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Net.SecurityProtocolType</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Tls11 </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-bor</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Net.SecurityProtocolType</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Tls12</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in; margin-top: 0in;"><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$SPAdminURL</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: #fcff01; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"https://contoso-admin.sharepoint.com"</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-SPOService</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Load SharePoint PnP PowerShell module</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Import-Module</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">PnP.Powershell</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Specify the URL of the site to generate a
site map for</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in; margin-top: 0in;"><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$siteUrl</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: #fcff01; color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"https://contoso.sharepoint.com/"</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Connect to SharePoint Online using an
app-only authentication context</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteUrl</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Interactive</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Get the root site and all subsites</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$sites</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-PnPSubWeb</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Recurse</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Create a hashtable to store the site map</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @{}</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Recursively add each subsite to the site
map</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$site</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$sites</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$site</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Url</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$site</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Title</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$site</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Webs</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Count
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-SubSite</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$site</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Url
</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Define a function to recursively add each
subsite to the site map</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">function</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-SubSite</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSites</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-PnPSubWeb</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-WebUrl</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSite</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSites</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSite</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Url</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSite</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Title</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSite</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Webs</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Count
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-SubSite</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$subSite</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Url
</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Output the site map as an HTML table</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$html</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"<table>"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Keys)
{</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$title</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteMap</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$html</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">+=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"<tr><td><a
href='</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$title</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"></a></td></tr>"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$html</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">+=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"</table>"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$table</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Site
map for site </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteUrl</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">:</span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$html</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Out-File</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-FilePath</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\SiteMap.html</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Disconnect from SharePoint Online</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Disconnect-PnPOnline</span></p></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-25756337310000328492023-02-13T12:07:00.004-08:002023-02-22T10:11:44.343-08:00PowerShell: Find Teams with Members but no Owners, and set all Members to Owners<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrvH1osHyAWM_QEgdodwC_1ftN6FpTYRLg10fGULW4uePmw8Tcs6_iYo4d8RgymQW3yu55VgJTav0l-Hrn5ew9E762A8_lZbROSUhmrKuSlQBUwbfY6Huy686pjNoCX5uiSHbmfMHKN-aeWKeDvuZZQDvsG8NZzO4qH_kHyC-vgRlpNeVjBhuhpibg7A/s909/teamsheader.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="511" data-original-width="909" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrvH1osHyAWM_QEgdodwC_1ftN6FpTYRLg10fGULW4uePmw8Tcs6_iYo4d8RgymQW3yu55VgJTav0l-Hrn5ew9E762A8_lZbROSUhmrKuSlQBUwbfY6Huy686pjNoCX5uiSHbmfMHKN-aeWKeDvuZZQDvsG8NZzO4qH_kHyC-vgRlpNeVjBhuhpibg7A/s320/teamsheader.jpg" width="320" /></a></div><br /><p></p><p>When a Team owner leaves the organization, they may leave behind a Team with no owners. This is bad from a number of perspectives. There is no one left to manage the Team, IT doesn't know who the Team belongs to, and no members can leave the Team if there is no owner. </p><p>This PowerShell script looks through every Team in your organization, reports back Teams that have members but no owners, and sets every member of that Team to be an owner. </p><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Connect-MicrosoftTeams<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#
Define a new object to gather output<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$OutputCollection</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @()<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#
Split path<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Split-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Parent</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"C:\SWSetup\*.*"<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$LogDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">yyyyMMddhhmm<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">+</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"\TeamsWithMembersButNoOwners_</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.csv"<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Verbose</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Getting
Team Names and Details"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> <br /> </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Team</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">ForEach-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"># Get Owners, members and guests<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-TeamUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-GroupId</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">GroupID <br /> </span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"owner"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"member"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamGuestCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"guest"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#If the Team has members but no owners<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">If</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-And</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){ <br />
</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> <br /> </span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"># Set each member to be an owner<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"member"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}){<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-TeamUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-GroupId</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">GroupID
</span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-User</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">User
</span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Role</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Owner<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"># Calculate Description word count <br /> </span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$DescriptionWordCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$null<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$DescriptionWordCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Description
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Out-String</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Measure-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Word</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">words<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#Get channel details<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Channels</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$null<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Channels</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-TeamChannel</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-GroupId</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">GroupID<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ChannelCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Channels</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Getting details for Team </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">DisplayName)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"># Put all details into an object<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">New-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-TypeName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">PSobject<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"DisplayName"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">DisplayName<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Description"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Description<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"DescriptionWordCount"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$DescriptionWordCount<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Visibility"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Visibility<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Archived"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Archived<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"ChannelCount"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ChannelCount<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"OwnerCount"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"MemberCount"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"GuestCount"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamGuestCount<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"GroupId"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">GroupId<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Export-Csv</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-NoTypeInformation</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Append<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span></div><h1 style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><u><span style="font-size: x-large;">Summary Script</span></u></h1><h2 style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="font-size: small;"><span style="font-weight: 400;">Before I could run this script, I had to do some investigation for management, giving them a summary of how many groups this would affect. The blow script outputs the numbers into a CSV for these categories:</span></span></h2><h2 style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="font-size: 9pt;"><span style="font-family: inherit;"><b><u><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEggVyPz9AhKGE4lEuBTWCe60zx31jurNvVZPNv5LwVYv2qHRahKwz-3z7EyEJfr4KLJ-HqstAGPUFEgSq5DQSa6TNHrIY-XA53S0qiYVuM8yFBee9et6WpBDHRer2rES9HSHVoakuyHa1kPm3Xya4Q9H-97MGNVM8rXd2xoC7yLlrWT1IoA19Kv9o3A2w" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="81" data-original-width="1329" height="40" src="https://blogger.googleusercontent.com/img/a/AVvXsEggVyPz9AhKGE4lEuBTWCe60zx31jurNvVZPNv5LwVYv2qHRahKwz-3z7EyEJfr4KLJ-HqstAGPUFEgSq5DQSa6TNHrIY-XA53S0qiYVuM8yFBee9et6WpBDHRer2rES9HSHVoakuyHa1kPm3Xya4Q9H-97MGNVM8rXd2xoC7yLlrWT1IoA19Kv9o3A2w=w640-h40" width="640" /></a></div><br /><br /></div></u></b></span></span><div style="text-align: left;"><span style="font-weight: normal;"><span style="background-color: transparent; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$owners0</span><span style="background-color: transparent; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: transparent; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="background-color: transparent; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: transparent; color: purple; font-family: "Lucida Console"; font-size: 9pt;">0</span></span></div></h2>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Connect-MicrosoftTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"># Define a new object to gather output</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$OutputCollection</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @()</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"># Split path</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Split-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Parent</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"C:\SWSetup\*.*"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$datestring</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">ToString(</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">“s”</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Replace(</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">“:”</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">”-”</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$LogDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"yyyy-MM-dd
hh:mm"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> $(</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"yyyy-MM-dd
hh:mm"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">+</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"\TeamsWithMembersButNoOwnersSummary.csv"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$sitelist</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Import-CSV</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\exportGroup_2023-2-14.csv</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Getting
Team Names and Details"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Start:
</span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Curr Time: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 0 owners & less than 2 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & 2-5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & more than 5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 1 Owner: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 1 Owner, 1 Member: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 2+ Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Total: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Errors: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#Get-Team | ForEach-Object {</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$sitelist</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">{ </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">source
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Cloud"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">groupType
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Microsoft
365"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">membershipType </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Assigned"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#
Get Owners, members and guests</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">try</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{ </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-TeamUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-GroupId</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">id
</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"owner"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"member"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamGuestCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"guest"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#If the Team has members but no owners</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">If</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-lt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">2</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">elseif</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-lt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">5</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">else</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">elseif</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">else</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ts</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">New-TimeSpan</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> $(</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">get-date</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ts</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Minutes </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">29</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> $(</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"yyyy-MM-dd hh:mm"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Start: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| Curr Time: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 0 Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & less than 2 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & 2-5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & more than 5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 1 Owner: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 1 Owner, 1 Member: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 2+ Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Total: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Errors: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Start: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| Curr Time: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 0 Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & less than 2 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & 2-5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & more than 5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 1 Owner: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 1 Owner, 1 Member: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 2+ Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Total: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Errors: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">>></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\errorlog_</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$datestring</span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.txt</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">catch</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">++</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Error
occurred on: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">displayName)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> (</span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">id)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">)
at </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> ""yyyy-MM-dd
hh:mm""</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">>></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\errorlog_</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$datestring</span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.txt</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-Output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Start: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| Curr Time: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$d1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 0 Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & less than 2 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & less than 5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 0 owners & more than 5 people: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 1 Owner: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | 1 Owner, 1 Member: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">
| 2+ Owners: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Total: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> | Errors: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">>></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\errorlog_</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$datestring</span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.txt</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$endTime</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"yyyy-MM-dd
hh:mm"</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">New-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-TypeName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">PSobject</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Start
Time"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"End
Time"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$endTime</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 0 Owners?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 0 owners and less than 2 people?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl2</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 0 owners and less than 5 people?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0ppl5</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 0 owners and more than 5 people?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners0pplMany</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 1 Owners?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 1 Owners & 1 Member?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$owners1ppl1</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of sites with 2+ Owners?"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ownersGood</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Number
of Teams Total"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AllTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Errors"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$ErrorTeams</span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Export-Csv</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-NoTypeInformation</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Append
<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in;"><o:p> </o:p></p><h1 style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span><span style="font-size: x-large;"><u><span style="font-family: inherit;">Itemized </span>User<span style="font-family: inherit;"> Script</span></u></span></span></h1><div>I also needed a list of users so that I could email them about changes that were going to be made to their Team. This is a script that outputs the members of each Team, filtered by ones that have no owners and over 5 members. To get the CSV file I'm referencing in the script, <a href="https://portal.azure.com/#view/Microsoft_AAD_IAM/GroupsManagementMenuBlade/~/AllGroups" target="_blank">I did an export from Azure AD Groups</a>.</div><div><span style="font-size: 12px;"><br /></span></div><div><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-MicrosoftTeams</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Split path</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Split-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Parent</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"C:\SWSetup\*.*"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$LogDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">yyyyMMddhhmm</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">+</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"\TeamsWith5PlusMembersButNoOwners-ItemizedUsers_</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.csv"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$sitelist</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Import-CSV</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\exportGroup_2023-2-14.csv</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Getting
Team Names and Details"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Get-Team | ForEach-Object {</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$sitelist</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">{ </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">source
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Cloud"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">groupType
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Microsoft
365"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">membershipType </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Assigned"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
Get Owners, members and guests</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-TeamUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-GroupId</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">id </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"owner"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"member"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamGuestCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"guest"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">})</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">count</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#If
the Team has members but no owners</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">If</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamOwnerCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-And</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamMemberCount</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">4</span><span style="font-family: "Lucida Console"; font-size: 9pt;">){
</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
Set each member to be an owner</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#foreach($u
in $TeamUsers| Where-Object {$_.Role -like "member"}){</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Add-TeamUser -GroupId $_.GroupID -User $u.User -Role Owner</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
}</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$TeamUsers</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"member"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}){</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Getting
details for Team </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">displayName)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">: </span><span style="font-family: "Lucida Console"; font-size: 9pt;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">User)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
Put all details into an object</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">New-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-TypeName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">PSobject</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"DisplayName"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">displayName</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">add-member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"GroupId"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">id</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"UserId"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">UserId</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"UPN"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">User</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Name"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Name</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Add-Member</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">NoteProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Role
"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Value</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$u</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Role</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> </span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$output</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Export-Csv</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-NoTypeInformation</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Append</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> }</span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;">} </span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in;"><o:p> </o:p></p></div><h2 style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="font-size: 9pt;"><span style="font-family: inherit;"><b><u>Sources</u></b>:</span></span></h2><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"></p><ul style="text-align: left;"><li><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> </span><a href="https://tomtalks.blog/find-microsoft-teams-teams-without-an-owner-teams-admin-center-and-powershell/">Find Microsoft Teams teams without an Owner, Teams Admin Center and PowerShell - Tom Talks</a></li><li><a href="https://github.com/tomarbuthnot/Microsoft-Teams-PowerShell/blob/master/Get-MicrosoftTeams-TeamSummary.ps1">Microsoft-Teams-PowerShell/Get-MicrosoftTeams-TeamSummary.ps1 at master · tomarbuthnot/Microsoft-Teams-PowerShell · GitHub</a></li></ul><p></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><o:p></o:p></span></p><p>
</p><p class="MsoNormal"><o:p> </o:p></p><p><br /></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-12298209149758543452023-01-30T05:50:00.002-08:002023-01-30T05:50:20.622-08:00Get AD Group info using PowerShell<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC8BWCio03UvGlw8Dr_Hwk9xvt5c7hG9NX-X75bPujJewSFhOh1vvpbZOf5kXqij2dh4Y6alUaAEGwLWDPYz3IIYAZsamtkhAcCEk-N7LQ4UdM5TmJ_-0Asjq11O7MfBrGxpgKN_mRxPHYlh7H_eq9P6BOwFoK3W3cZ6K98yk2n8gSOYhmf_ftj7RejQ/s937/active-directory-logo-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="937" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC8BWCio03UvGlw8Dr_Hwk9xvt5c7hG9NX-X75bPujJewSFhOh1vvpbZOf5kXqij2dh4Y6alUaAEGwLWDPYz3IIYAZsamtkhAcCEk-N7LQ4UdM5TmJ_-0Asjq11O7MfBrGxpgKN_mRxPHYlh7H_eq9P6BOwFoK3W3cZ6K98yk2n8gSOYhmf_ftj7RejQ/s320/active-directory-logo-1.png" width="320" /></a></div>Here's a PowerShell command that will help get a few of the properties you need from an Active Directory group, filtered by the name with a wildcard. it outputs a table of groups that match the filter clause.<p></p><div style="text-align: left;"><span style="font-family: courier;">Import-Module ActiveDirectory<br />Get-ADGroup -Filter "name -like '<span style="background-color: #fcff01;">GroupNameGoesHere-</span>*'" -Properties * | Select-Object cn, @{Label = "Manager";Expression = {%{(Get-AdUser $_.managedBy -Properties DisplayName).DisplayName}}}, description</span></div><div style="text-align: left;"><br /></div><div style="text-align: left;">Sources:</div><div style="text-align: left;"><ul style="text-align: left;"><li><a href="https://social.technet.microsoft.com/wiki/contents/articles/12079.active-directory-get-adgroup-default-and-extended-properties.aspx#:~:text=The%20PowerShell%20Get-ADGroup%20cmdlet%20supports%20the%20default%20and,in%20cyan.%20Extended%20properties%20are%20highlighted%20in%20pink.">Active Directory: Get-ADGroup Default and Extended Properties - TechNet Articles - United States (English) - TechNet Wiki (microsoft.com)</a></li><li><a href="https://community.spiceworks.com/topic/2207938-getting-extension-attribute-of-a-group-depends-on-extension-attribute-of-aduser">[SOLVED] Getting extension attribute of a group depends on extension attribute of aduser - PowerShell (spiceworks.com)</a></li></ul></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-37540348251072955972023-01-24T06:54:00.010-08:002023-01-24T07:25:23.103-08:00SharePoint Online: Version History Summary Report using PowerShell<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnOXauaQrhlABuaCOZIuVjz58qz8S085DR744FCcrXcvT57i1v9A5j4L53hoW22OIKbUIEf2LymL250mXgWrmYT5isYDaM3ef4YvUFa14GS4vrsyt8pa7ZvReMxHRyU5wA7iX2Rq9WWkgYR_-VO7cIt4Dyjktdori085suQrNyH5lseRBpYHakzT_YfA/s614/Logo-Final-Sharepoint-1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnOXauaQrhlABuaCOZIuVjz58qz8S085DR744FCcrXcvT57i1v9A5j4L53hoW22OIKbUIEf2LymL250mXgWrmYT5isYDaM3ef4YvUFa14GS4vrsyt8pa7ZvReMxHRyU5wA7iX2Rq9WWkgYR_-VO7cIt4Dyjktdori085suQrNyH5lseRBpYHakzT_YfA/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div><a href="https://www.sharepointdiary.com/2016/12/sharepoint-online-version-history-report-using-powershell.html" target="_blank">SharePoint Diary posted a script for generating a report </a>for all versions of a document in a document library. I needed something similar, but not an itemized list. I needed a summary report for all SharePoint online sites listed in a CSV. So I modified the script to accomplish that. This script reads in a list of URLs from a CSV and report out a size list for each site for files, versions, and combined. <p></p><div style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; text-align: left;"><span style="font-size: xx-small;"><span style="color: darkgreen; font-family: "Lucida Console";">#Set Variables<br /></span><span style="color: #a82d00; font-family: "Lucida Console";">$sitelist</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Import-CSV</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">C:\SWSetup\SPOSiteList.csv<br /></span><span style="color: #a82d00; font-family: "Lucida Console";">$SPAdminURL</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"https://contoso-admin.sharepoint.com"<br /></span><span style="color: blue; font-family: "Lucida Console";">Connect-PnPOnline</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$SPAdminURL</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Interactive<br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="color: darkgreen; font-family: "Lucida Console";">#Exclude certain libraries<br /></span><span style="color: #a82d00; font-family: "Lucida Console";">$ExcludedLists</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> (</span><span style="color: darkred; font-family: "Lucida Console";">"Preservation
Hold Library"</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console";">"Site Assets"</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console";">"Site Pages"</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console";">"Style Library"</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console";">"Form Templates"</span><span style="font-family: "Lucida Console";">)<br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="color: #a82d00; font-family: "Lucida Console";">$datestring</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> (</span><span style="color: blue; font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console";">)</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">ToString(</span><span style="color: darkred; font-family: "Lucida Console";">“s”</span><span style="font-family: "Lucida Console";">)</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">Replace(</span><span style="color: darkred; font-family: "Lucida Console";">“:”</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console";">”-”</span><span style="font-family: "Lucida Console";">)<br /></span><span style="color: #a82d00; font-family: "Lucida Console";">$CSVPath</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"C:\SWSetup\VersionSizeSummary_"</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">+</span><span style="font-family: "Lucida Console";"> $(</span><span style="color: #a82d00; font-family: "Lucida Console";">$datestring</span><span style="font-family: "Lucida Console";">) </span><span style="color: dimgrey; font-family: "Lucida Console";">+</span><span style="color: darkred; font-family: "Lucida Console";">".csv"<br /></span><span style="color: darkred; font-family: "Lucida Console";">"SiteURL `t File Size (GB) `t Version Size
(GB) `t Total File Size (GB)"</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Out-File</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$CSVPath</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Append<br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="color: darkblue; font-family: "Lucida Console";">Function</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">Enable-PnPVersionReport</span><span style="font-family: "Lucida Console";">(</span><span style="color: #a82d00; font-family: "Lucida Console";">$SiteURL</span><span style="font-family: "Lucida Console";">)<br /></span><span style="font-family: "Lucida Console";">{ <br /> </span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Connect
to SharePoint Online site<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Connect-PnPOnline</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$SiteURL</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Interactive<br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$FileSizeinGB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: purple; font-family: "Lucida Console";">0<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSize</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: purple; font-family: "Lucida Console";">0<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSizeinGB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: purple; font-family: "Lucida Console";">0<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$TotalFileSizeGB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: purple; font-family: "Lucida Console";">0</span><span style="color: #a82d00; font-family: "Lucida Console";"><br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$Lists</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-PnPList</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Where-Object</span><span style="font-family: "Lucida Console";"> {</span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">Hidden
</span><span style="color: dimgrey; font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$False</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">BaseType
</span><span style="color: dimgrey; font-family: "Lucida Console";">-eq</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"DocumentLibrary"</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$ExcludedLists</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">-notcontains</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">Title}<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkblue; font-family: "Lucida Console";">Foreach</span><span style="font-family: "Lucida Console";"> (</span><span style="color: #a82d00; font-family: "Lucida Console";">$l</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkblue; font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$Lists</span><span style="font-family: "Lucida Console";">)<br /></span><span style="font-family: "Lucida Console";"> { <br /> </span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Write-host "Connecting to $($l.Title)" -f Magenta<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$items</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-PnPListItem</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-List</span><span style="font-family: "Lucida Console";"> $(</span><span style="color: #a82d00; font-family: "Lucida Console";">$l</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">Title)<br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionHistoryData</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> @()<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Iterate through all files<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-PnPListItem</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-List</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$l</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-PageSize</span><span style="font-family: "Lucida Console";"> </span><span style="color: purple; font-family: "Lucida Console";">500</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Where</span><span style="font-family: "Lucida Console";"> {</span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">FieldValues</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">FileLeafRef
</span><span style="color: dimgrey; font-family: "Lucida Console";">-like</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"*.*"</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">-and</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console";">string</span><span style="color: dimgrey; font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console";">IsNullOrEmpty(</span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">FieldValues</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">File_x0020_Type)
</span><span style="color: dimgrey; font-family: "Lucida Console";">-ne</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"True"</span><span style="font-family: "Lucida Console";"> } </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">ForEach-Object</span><span style="font-family: "Lucida Console";"> {<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Write-host "Getting Versioning Data of the
File:"$_.FieldValues.FileRef -f Green<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Get FileSize & version Size<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$FileSizeinGB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">+=</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console";">Math</span><span style="color: dimgrey; font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console";">Round((</span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">FieldValues</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">File_x0020_Size</span><span style="color: dimgrey; font-family: "Lucida Console";">/</span><span style="color: purple; font-family: "Lucida Console";">1GB</span><span style="font-family: "Lucida Console";">)</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: purple; font-family: "Lucida Console";">2</span><span style="font-family: "Lucida Console";">)<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$File</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-PnPProperty</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-ClientObject</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$_</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Property</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">File<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$Versions</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-PnPProperty</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-ClientObject</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$File</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Property</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">Versions<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkblue; font-family: "Lucida Console";">If</span><span style="font-family: "Lucida Console";">(</span><span style="color: #a82d00; font-family: "Lucida Console";">$Versions</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">Count </span><span style="color: dimgrey; font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console";"> </span><span style="color: purple; font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console";">){<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSize</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">+=</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$Versions</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Measure-Object</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Property</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">Size</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Sum</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Select-Object</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-expand</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">Sum<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSizeinGB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">+=</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console";">Math</span><span style="color: dimgrey; font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console";">Round((</span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSize</span><span style="color: dimgrey; font-family: "Lucida Console";">/</span><span style="color: purple; font-family: "Lucida Console";">1GB</span><span style="font-family: "Lucida Console";">)</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: purple; font-family: "Lucida Console";">2</span><span style="font-family: "Lucida Console";">)<br /></span><span style="font-family: "Lucida Console";"> }<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkblue; font-family: "Lucida Console";">Else</span><span style="font-family: "Lucida Console";">{<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Write-host -f Red "No Versions Found!"<br /></span><span style="font-family: "Lucida Console";"> }<br /></span><span style="font-family: "Lucida Console";"> }<br /></span><span style="font-family: "Lucida Console";"> }<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$TotalFileSizeKB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console";">Math</span><span style="color: dimgrey; font-family: "Lucida Console";">]::</span><span style="font-family: "Lucida Console";">Round((</span><span style="color: #a82d00; font-family: "Lucida Console";">$FileSizeinGB</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">+</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSizeinGB</span><span style="font-family: "Lucida Console";">)</span><span style="color: dimgrey; font-family: "Lucida Console";">,</span><span style="color: purple; font-family: "Lucida Console";">2</span><span style="font-family: "Lucida Console";">)<br /> </span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console";">$(</span><span style="color: #a82d00; font-family: "Lucida Console";">$SiteURL</span><span style="font-family: "Lucida Console";">)</span><span style="color: darkred; font-family: "Lucida Console";">
`t </span><span style="font-family: "Lucida Console";">$(</span><span style="color: #a82d00; font-family: "Lucida Console";">$FileSizeinGB</span><span style="font-family: "Lucida Console";">)</span><span style="color: darkred; font-family: "Lucida Console";"> `t </span><span style="font-family: "Lucida Console";">$(</span><span style="color: #a82d00; font-family: "Lucida Console";">$VersionSizeinGB</span><span style="font-family: "Lucida Console";">)</span><span style="color: darkred; font-family: "Lucida Console";">
`t </span><span style="font-family: "Lucida Console";">$(</span><span style="color: #a82d00; font-family: "Lucida Console";">$TotalFileSizeGB</span><span style="font-family: "Lucida Console";">)</span><span style="color: darkred; font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Out-File</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$CSVPath</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Append<br /></span><span style="font-family: "Lucida Console";"> }<br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkblue; font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console";"> (</span><span style="color: #a82d00; font-family: "Lucida Console";">$s</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkblue; font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$sitelist</span><span style="font-family: "Lucida Console";">)<br /></span><span style="font-family: "Lucida Console";">{<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Connect
to SharePoint Online Site from PnP Online<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Connect-PnPOnline</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">URL
</span><span style="color: navy; font-family: "Lucida Console";">-Interactive<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Write-host</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"Reporting
started for "</span><span style="color: #a82d00; font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">URL
</span><span style="color: navy; font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">Yellow<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$start</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-Date<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: darkgreen; font-family: "Lucida Console";">#Get
all Webs and call the function to set version history<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Get-PnPSubWeb</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-IncludeRootWeb</span><span style="font-family: "Lucida Console";"> </span><span style="color: dimgrey; font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">ForEach-Object</span><span style="font-family: "Lucida Console";"> {</span><span style="color: blue; font-family: "Lucida Console";">Enable-PnPVersionReport</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">URL}<br /></span><span style="font-family: "Lucida Console";"> </span><span style="color: blue; font-family: "Lucida Console";">Write-host</span><span style="font-family: "Lucida Console";"> </span><span style="color: darkred; font-family: "Lucida Console";">"Reporting
complete for "</span><span style="color: #a82d00; font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console";">URL</span><span style="color: darkred; font-family: "Lucida Console";">" Time Elapsed: "</span><span style="font-family: "Lucida Console";">(</span><span style="color: blue; font-family: "Lucida Console";">New-TimeSpan</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-Start</span><span style="font-family: "Lucida Console";"> </span><span style="color: #a82d00; font-family: "Lucida Console";">$start</span><span style="font-family: "Lucida Console";"> </span><span style="color: navy; font-family: "Lucida Console";">-End</span><span style="font-family: "Lucida Console";"> (</span><span style="color: blue; font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console";">)) </span><span style="color: navy; font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console";"> </span><span style="color: blueviolet; font-family: "Lucida Console";">Yellow<br /></span><span style="font-family: "Lucida Console";">} </span></span></div><p>
</p><p>The output file will look something like this:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7iSeD7AS5VZatKA7euMk3ZVUd66928eQKt9aEkGm9Nl6UEzoktZgck_vipoqKAeCdvj2NrFFrDW5qOIVt-dE336fWZW9Waj465QBt-5p_FfEwqWZvm-UvdX3ZeK7BNBvrNDxx6oCW9YLBDDm8a_8tvgP5Yov6L3bHBLypxvyrtfF8rnA83KxuBJggHg/s800/VersionSizeSummary-Excel.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="88" data-original-width="800" height="70" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7iSeD7AS5VZatKA7euMk3ZVUd66928eQKt9aEkGm9Nl6UEzoktZgck_vipoqKAeCdvj2NrFFrDW5qOIVt-dE336fWZW9Waj465QBt-5p_FfEwqWZvm-UvdX3ZeK7BNBvrNDxx6oCW9YLBDDm8a_8tvgP5Yov6L3bHBLypxvyrtfF8rnA83KxuBJggHg/w640-h70/VersionSizeSummary-Excel.jpg" width="640" /></a></div><br /><h1 style="text-align: left;">Original Script</h1><p>This is the original script that I based my script off of. It generates the version history analysis for all libraries on a single site. Additional sources below that helped me modify this script.</p><div style="background: white; line-height: 13.2pt; margin-bottom: 0in; text-align: left; vertical-align: baseline;"><span style="font-size: xx-small;"><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Parameters<br /></span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$SiteURL</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"https://crescent.sharepoint.com/sites/vendors"<br /></span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$CSVFile</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"C:\Temp\VersionHistoryRpt.csv"<br /></span><span style="color: #212121; font-family: Consolas;"> <br /></span><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Delete the Output report file if exists<br /></span><b><span style="border: 1pt none windowtext; color: #006699; font-family: Consolas; padding: 0in;">If</span></b><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">(</span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Test-Path</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$CSVFile</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">) { </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Remove-Item</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$CSVFile</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">}<br /></span><span style="color: #212121; font-family: Consolas;"> <br /></span><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Connect to SharePoint Online site<br /></span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Connect-PnPOnline</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Url</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$SiteURL</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Interactive<br /></span><span style="color: #212121; font-family: Consolas;"> <br /></span><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Get All Document Libraries from the Web - Exclude Hidden and
certain lists<br /></span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$ExcludedLists</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= @(</span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Form Templates"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">, </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Preservation Hold Library"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">,</span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Site Assets"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">, </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Pages"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">, </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Site Pages"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">, </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Images"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">,<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Site Collection
Documents"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">, </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Site Collection Images"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">,</span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Style Library"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">)<br /></span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Lists</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Get-PnPList</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">| </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Where-Object</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">{</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.Hidden </span><span style="border: 1pt none windowtext; color: #009900; font-family: Consolas; padding: 0in;">-eq</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$False</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #009900; font-family: Consolas; padding: 0in;">-and</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.Title</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-notin</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$ExcludedLists</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #009900; font-family: Consolas; padding: 0in;">-and</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.BaseType </span><span style="border: 1pt none windowtext; color: #009900; font-family: Consolas; padding: 0in;">-eq</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"DocumentLibrary"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">}<br /></span><span style="color: #212121; font-family: Consolas;"> <br /></span><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Iterate through all files from all document libraries<br /></span><b><span style="border: 1pt none windowtext; color: #006699; font-family: Consolas; padding: 0in;">ForEach</span></b><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">(</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$List</span><span style="color: #212121; font-family: Consolas;"> </span><b><span style="border: 1pt none windowtext; color: #006699; font-family: Consolas; padding: 0in;">in</span></b><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Lists</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">)<br /></span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">{<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$global:counter</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= 0<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Files</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Get-PnPListItem</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-List</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$List</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-PageSize</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">2000</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Fields</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">File_x0020_Size, FileRef</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-ScriptBlock</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">{ </span><b><span style="border: 1pt none windowtext; color: #006699; font-family: Consolas; padding: 0in;">Param</span></b><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">(</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$items</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">) </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$global:counter</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">+= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$items</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.Count; </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Write-Progress</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-PercentComplete</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">(</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$global:Counter</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">/ (</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$List</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.ItemCount) * 100)</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Activity</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Getting Files of '$($List.Title)'"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Status</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Processing Files
$global:Counter to $($List.ItemCount)"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">;} | Where {</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.FileSystemObjectType </span><span style="border: 1pt none windowtext; color: #009900; font-family: Consolas; padding: 0in;">-eq</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"File"</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">}<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="color: #212121; font-family: Consolas;"> <br /><o:p></o:p></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionHistoryData</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= @()<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Files</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">| </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">ForEach-Object</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">{<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Write-host</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Getting Versioning Data
of the File:"</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.FieldValues.FileRef<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Get File Size and version Size<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$FileSizeinKB</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #0066cc; font-family: Consolas; padding: 0in;">[Math]</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">::Round((</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.FieldValues.File_x0020_Size/1KB),2)<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$File</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Get-PnPProperty</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-ClientObject</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Property</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">File<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Versions</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Get-PnPProperty</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-ClientObject</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$File</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Property</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Versions<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionSize</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Versions</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">| </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Measure-Object</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Property</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Size</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Sum</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">| </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Select-Object</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-expand</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Sum<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionSizeinKB</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #0066cc; font-family: Consolas; padding: 0in;">[Math]</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">::Round((</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionSize</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">/1KB),2)<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$TotalFileSizeKB</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #0066cc; font-family: Consolas; padding: 0in;">[Math]</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">::Round((</span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$FileSizeinKB</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">+ </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionSizeinKB</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">),2)<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="color: #212121; font-family: Consolas;"> <br /><o:p></o:p></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #008200; font-family: Consolas; padding: 0in;">#Extract Version History data<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionHistoryData</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">+=</span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">New-Object</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">PSObject</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Property</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">(</span><span style="border: 1pt none windowtext; color: #0066cc; font-family: Consolas; padding: 0in;">[Ordered]</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">@{<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Library Name"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$List</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.Title<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"File Name"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.FieldValues.FileLeafRef<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"File URL"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$_</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.FieldValues.FileRef<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Versions"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$Versions</span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">.Count<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"File Size (KB)"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$FileSizeinKB<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Version Size (KB)"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionSizeinKB<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: blue; font-family: Consolas; padding: 0in;">"Total File Size
(KB)"</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">= </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$TotalFileSizeKB<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">})<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">}<br /></span><span style="border: 1pt none windowtext; color: #212121; font-family: Consolas; padding: 0in;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$VersionHistoryData</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">| </span><span style="border: 1pt none windowtext; color: deeppink; font-family: Consolas; padding: 0in;">Export-Csv</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Path</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: #aa7700; font-family: Consolas; padding: 0in;">$CSVFile</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-NoTypeInformation</span><span style="color: #212121; font-family: Consolas;"> </span><span style="border: 1pt none windowtext; color: grey; font-family: Consolas; padding: 0in;">-Append<br /></span><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">}</span><br /></span></div><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;">
</p><p class="MsoNormal"><o:p></o:p></p><p class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-margin-bottom-alt: 8.0pt; mso-margin-top-alt: 0in; text-autospace: none;"><span style="font-family: "Lucida Console";"></span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgzOf0L2CVc1TlYoGqNsbhko746RxG4PO1OeSnzYMdENS7OZt2V0rIGRr1Blr24RZPLaTyts7jWRvd4vl6k0Pn1rNl94XzG1KINYVYo1u4P05GptrzzA7GhYKr-BJZYjlaUnII7niJKwF4_T8JYp8BK3OmEW1oKTONdmedxD6pRtfscuN9xW3oN7d_-w/s973/pnp-powershell-to-generate-version-history-report-in-sharepoint-online.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="323" data-original-width="973" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgzOf0L2CVc1TlYoGqNsbhko746RxG4PO1OeSnzYMdENS7OZt2V0rIGRr1Blr24RZPLaTyts7jWRvd4vl6k0Pn1rNl94XzG1KINYVYo1u4P05GptrzzA7GhYKr-BJZYjlaUnII7niJKwF4_T8JYp8BK3OmEW1oKTONdmedxD6pRtfscuN9xW3oN7d_-w/w640-h212/pnp-powershell-to-generate-version-history-report-in-sharepoint-online.png" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><span style="font-size: xx-small;"><br /></span><p></p><p>
</p><b><u>Sources</u></b>:<div><ul style="text-align: left;"><li><a href="https://www.sharepointdiary.com/2016/12/sharepoint-online-version-history-report-using-powershell.html">SharePoint Online: Version History Report using PowerShell - SharePoint Diary</a></li><li><a href="https://www.delftstack.com/howto/powershell/powershell-if-not-null/#:~:text=The%20following%20example%20checks%20if%20a%20%24string%20variable,%28%24string%29%20%7B%20Write-Host%20%22The%20variable%20is%20not%20null.%22">Check if a String Is Not NULL or EMPTY in PowerShell | Delft Stack</a></li><li><a href="https://www.sharepointdiary.com/2019/09/sharepoint-online-powershell-get-managed-metadata-field-value.html">SharePoint Online: PowerShell to Get Managed Metadata Field Value - SharePoint Diary</a></li><li><a href="https://adamtheautomator.com/powershell-where-object/">How to Use PowerShell Where-Object to Filter All the Things (adamtheautomator.com)</a></li><li><a href="https://techcommunity.microsoft.com/t5/sharepoint-developer/how-do-i-get-the-version-of-a-file-using-pnp-powershell/m-p/156100">How Do I get the version of a file using PnP Powershell - Microsoft Community Hub</a></li><li><a href="https://mybrokensharepoint.wordpress.com/2021/03/17/sharepoint-pnp-list-item-show-all-fields/">SharePoint PnP List Item -Show All Fields – My Broken SharePoint (wordpress.com)</a></li><li><a href="https://www.sharepointdiary.com/2018/06/sharepoint-online-download-all-versions-using-powershell.html">SharePoint Online: Download All Versions of a Document using PowerShell - SharePoint Diary</a></li></ul><p><br /></p></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-48425532868084383622023-01-21T09:21:00.002-08:002023-01-21T09:21:29.076-08:00Get-AzureADUser – Export Azure AD Users with PowerShell<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCSkPDRgUafzAdCp5F2BdhahqDhAs4_vULqzJPbhrXd8M_1lmf1sgShT05of6JbepklLymvagz2K9ai9TOMH0odrwk-Twa8JUK0Gikj4DTbDIQUsENQmlfgi1xfYhP7kutJH60gpPbGqZ-2pJIlx4lOCwGikPz-FxhPqTRcCysyyTx72FcBaxYAD7a4g/s937/active-directory-logo-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="937" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCSkPDRgUafzAdCp5F2BdhahqDhAs4_vULqzJPbhrXd8M_1lmf1sgShT05of6JbepklLymvagz2K9ai9TOMH0odrwk-Twa8JUK0Gikj4DTbDIQUsENQmlfgi1xfYhP7kutJH60gpPbGqZ-2pJIlx4lOCwGikPz-FxhPqTRcCysyyTx72FcBaxYAD7a4g/s320/active-directory-logo-1.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;">This script will connect to Azure Active Directory, and download a user report to CSV file.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><div style="background: white; line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Import-Module</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Name</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">AzureAD<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-AzureAD<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$ErrorActionPreference</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Stop"<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Function</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Users</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><#<br /><o:p></o:p></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> .SYNOPSIS<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> Get users from the requested DN<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> #><br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">process</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Set the properties to retrieve<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$properties</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @(<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'ObjectId'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'DisplayName'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'userprincipalname'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'mail'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'jobtitle'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'department'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'telephoneNumber'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'PhysicalDeliveryOfficeName'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'mobile'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'streetAddress'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'city'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'postalcode'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'state'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'country'</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">'AccountEnabled'<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> )<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"AccountEnabled eq true"<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Get the users<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-AzureADUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$filter</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-All</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$true</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">select</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$properties<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Function</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-AllAzureADUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><#<br /><o:p></o:p></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> .SYNOPSIS<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> Get all AD users<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> #><br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">process</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Collecting users"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-ForegroundColor</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Cyan<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;">
@()<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Collect users<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">+=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Users<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Loop through all users<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$users</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">ForEach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$manager</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">""<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">If</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> ((</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$getManager</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">IsPresent)) {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Get the users' manager<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$manager</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-AzureADUserManager</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-ObjectId</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">ObjectId
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Select</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-ExpandProperty</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">DisplayName<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="color: #006161; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">pscustomobject</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">]</span><span style="font-family: "Lucida Console"; font-size: 9pt;">@{<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Name"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">DisplayName<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"UserPrincipalName"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">UserPrincipalName<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Emailaddress"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">mail<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Job title"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">JobTitle<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Manager"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$manager<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Department"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Department<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Office"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">PhysicalDeliveryOfficeName<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Phone"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">telephoneNumber<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Mobile"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">mobile<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Enabled"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">AccountEnabled)
{</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"enabled"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">} </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">else</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> {</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"disabled"</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Street"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">StreetAddress<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"City"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">City<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Postal code"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">PostalCode<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"State"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">State<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Country"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Country<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
Split path<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Split-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Parent</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"C:\SWSetup\*.*"<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
Create variable for the date stamp in log file<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$LogDate</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">yyyyMMddhhmm<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
Define CSV and log file location variables<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#
They have to be on the same location as the script<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">+</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"\AllAzADUsers_</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$logDate</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.csv"<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-AllAzureADUsers</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Sort-Object</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Name</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Export-CSV</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-NoTypeInformation<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">if</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> ((</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Item</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">Length </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-gt</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">0</span><span style="font-family: "Lucida Console"; font-size: 9pt;">) {<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Report finished and saved in </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-ForegroundColor</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Green<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"># Open the CSV file<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Invoke-Item</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$path<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">}</span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">else</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Failed to create report"</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-ForegroundColor</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Red<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">}<br /> </span><o:p> </o:p><br /></div>
</div><p style="text-align: left;"><b><u>Sources</u></b></p><p style="text-align: left;"></p><ul style="text-align: left;"><li><a href="https://www.alitajran.com/export-azure-ad-users-to-csv-powershell/#:~:text=Export%20Azure%20Active%20Directory%20users%20to%20CSV%20with,Open%20Azure%20AD%20users%20report%20CSV%20file%20">Export Azure AD users to CSV with PowerShell - ALI TAJRAN</a></li><li><a href="https://lazyadmin.nl/powershell/get-azureaduser/">Get AzureADUser - How to Find Azure AD Users with PowerShell (lazyadmin.nl)</a></li><li><a href="https://github.com/ruudmens/LazyAdmin/blob/master/ActiveDirectory/Get-ADUsers.ps1">LazyAdmin/Get-ADUsers.ps1 at master · ruudmens/LazyAdmin · GitHub</a></li></ul><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-41169265970384723152023-01-04T08:43:00.000-08:002023-01-04T08:43:24.099-08:00Excel - Math functions on filtered columns<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6nojseHOFrpEY0GK7OdP06A0Lc_2j1f_tpSySjBbuU_N4Y3iUE0BL7HHo9AYOiAuCrbC4MkXYi0aXK9Br66B9KG_AsIWZlXh_5t-eB4n1i2mf-tfMdSJkMKSoiMvQQaWUQy-ewRRYVTRWF_xTe5J3jdW_2fO3SJsibMPa2eCv-JxiTGbhBhaDP90B7Q/s900/excel.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="330" data-original-width="900" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6nojseHOFrpEY0GK7OdP06A0Lc_2j1f_tpSySjBbuU_N4Y3iUE0BL7HHo9AYOiAuCrbC4MkXYi0aXK9Br66B9KG_AsIWZlXh_5t-eB4n1i2mf-tfMdSJkMKSoiMvQQaWUQy-ewRRYVTRWF_xTe5J3jdW_2fO3SJsibMPa2eCv-JxiTGbhBhaDP90B7Q/w640-h234/excel.png" width="640" /></a></div><br /><p></p><div style="text-align: left;">I needed to perform some math on filtered columns in Excel. To do that I needed to use the SUBTOTAL function. </div><div style="text-align: left;"><br />1) Counting how many items in a filtered column</div><div style="text-align: left;"><br />=SUBTOTAL(3,A3:A999999)</div><div style="text-align: left;">or</div><div style="text-align: left;">=CONCAT("Num Sites: ",SUBTOTAL(3,A3:A999999))</div><div style="text-align: left;"><br />2) Adding values in a filtered column. I also needed to convert GB to TB so I needed to do additional math.</div><div style="text-align: left;"><br />=ROUND(SUBTOTAL(109,F3:F99999)/1024,3)</div><div style="text-align: left;">or<br />=CONCAT(ROUND(SUBTOTAL(109,F3:F99999)/1024,3)," TB Used")</div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-40736565871656010482023-01-04T06:05:00.002-08:002023-01-04T06:05:36.739-08:00SharePoint Online: Set document library versioning on many sites using PowerShell<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IfV0RmiZK1lT6hKT1GZB-Xrgqr3fJZBjjX2GwxvMLJjaPyaqF_qe2Ifcd3ZXNitpb8aIRQiEF2eL96SmfTHCF7jG9OaCiZaeSPKurSl7ALDHJdiDPrOzBtfyW9I4Ip8QyhcDYJS2kcIqK-TugGE4waN4vLMlBrOJ9yeZrwcRcxhfMLHPU4zSN0pb2Q/s614/Logo-Final-Sharepoint-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IfV0RmiZK1lT6hKT1GZB-Xrgqr3fJZBjjX2GwxvMLJjaPyaqF_qe2Ifcd3ZXNitpb8aIRQiEF2eL96SmfTHCF7jG9OaCiZaeSPKurSl7ALDHJdiDPrOzBtfyW9I4Ip8QyhcDYJS2kcIqK-TugGE4waN4vLMlBrOJ9yeZrwcRcxhfMLHPU4zSN0pb2Q/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div>This PowerShell script imports Sharepoint Online URLs from a CSV, and sets versioning limits on all document libraries in each site in the CSV.<p></p><p></p><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><#<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Set
Version limits for all Doc Libraries in SharePoint Online Sites lised in a CSV<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Author:
Tom DeMeulenaere<span style="mso-spacerun: yes;"> </span>- Jan 4, 2023<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> <br /></o:p></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Source:
https://www.sharepointdiary.com/2016/05/sharepoint-online-enable-versioning-on-all-lists-powershell.html<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#><br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> <br /></o:p></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$sitelist</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Import-CSV</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\SharepointSites.csv<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"https://contoso-admin.sharepoint.com"<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Interactive<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> <br /></o:p></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Exclude
certain libraries<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$ExcludedLists</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> (</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Preservation
Hold Library"</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Site Assets"</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Site Pages"</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Style Library"</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Form Templates"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> <br /></o:p></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Function</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Enable-PnPVersionHistory</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SiteURL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">{<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Processing Web </span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">$(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">URL)</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Cyan<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SiteURL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Interactive<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Get All Document Libraries<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Lists</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-PnPList</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Where-Object</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> {</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Hidden </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$False</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-and</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">BaseType </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-eq</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"DocumentLibrary"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-and</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$ExcludedLists</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-notcontains</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Title}<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Enable Version History for Document Libraries<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Lists</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">ForEach-Object</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> {<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$Params</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> @{<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">
</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Identity"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">
</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Title<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">
</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"EnableVersioning"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$True<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">
</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"MajorVersions"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">50<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">
</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"MinorVersions"</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: purple; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">10<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> }<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Set-PnPList</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">@Params<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Enabled Version History for "</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Title </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Green<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> }<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">}<br /></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> <br /></o:p></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$sitelist</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">{<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Connect to SharePoint Online Site from PnP Online<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">URL
</span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Interactive<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$start</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Date<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Get all Webs and call the function to set version history<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-PnPSubWeb</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-IncludeRootWeb</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">ForEach-Object</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> { </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Enable-PnPVersionHistory</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">URL
}<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"Completed setting versioning for "</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">URL</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"
Time Elapsed: "</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">(</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">New-TimeSpan</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Start</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$start</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-End</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> (</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)) </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Yellow<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">} </span></div>
<p class="MsoNormal"><o:p> </o:p></p>Source: <a href="https://www.sharepointdiary.com/2016/05/sharepoint-online-enable-versioning-on-all-lists-powershell.html">SharePoint Online: Enable Versioning on All List and Libraries using PowerShell - SharePoint Diary</a><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-24229153142543087122023-01-04T05:52:00.005-08:002023-01-23T11:22:59.828-08:00SharePoint Online: Set Admin for many sites using PowerShell<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IfV0RmiZK1lT6hKT1GZB-Xrgqr3fJZBjjX2GwxvMLJjaPyaqF_qe2Ifcd3ZXNitpb8aIRQiEF2eL96SmfTHCF7jG9OaCiZaeSPKurSl7ALDHJdiDPrOzBtfyW9I4Ip8QyhcDYJS2kcIqK-TugGE4waN4vLMlBrOJ9yeZrwcRcxhfMLHPU4zSN0pb2Q/s614/Logo-Final-Sharepoint-1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IfV0RmiZK1lT6hKT1GZB-Xrgqr3fJZBjjX2GwxvMLJjaPyaqF_qe2Ifcd3ZXNitpb8aIRQiEF2eL96SmfTHCF7jG9OaCiZaeSPKurSl7ALDHJdiDPrOzBtfyW9I4Ip8QyhcDYJS2kcIqK-TugGE4waN4vLMlBrOJ9yeZrwcRcxhfMLHPU4zSN0pb2Q/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div>This simple script lets you set an admin for multiple sites listed in a CSV file. It is helpful for when you want to perform admin actions on multiple sites <p></p><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"https://contoso-admin.sharepoint.com"<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Connect-SPOService</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#$siteInfo
= Get-SPOSite -Limit ALL |Select GroupId, URL<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Import-CSV</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\SharepointSites.csv<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AcctName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"username@contoso.com"<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="font-family: "Lucida Console"; font-size: 9pt;">)<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">{<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Set-SPOUser</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Site</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">URL </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-IsSiteCollectionAdmin</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$true</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-LoginName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AcctName<br /></span><span style="font-family: "Lucida Console"; font-size: 9pt;">} </span></div><p>
</p><p><br /></p><p>When you are finished, re-run the script, changing the $true to $false in Set-SPOUser.</p><p>If you have a O365 group to set as the owner, it's a little more complicated. Here is the script to do that:</p><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><br /><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"https://</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 12px;">contoso-admin.sharepoint.com</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">"<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-SPOService</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Interactive<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-SPOSite</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Limit</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">ALL</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Select</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">GroupId</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">URL<br /></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#$siteInfo
= Import-CSV </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 12px;">C:\SWSetup\SharepointSites.csv</span></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p> </o:p></span><span style="font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><o:p><br /></o:p></span><span style="color: darkgreen; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">#Multiple
Sites with Group Owner<br /></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Function</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">EnsureLoginName</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$userOrGroupName</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">) {<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$web</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Get-PnPWeb<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$userOrGroup</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$web</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">EnsureUser(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$userOrGroupName</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$web</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Context</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Load(</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$userOrGroup</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$web</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Context</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">ExecuteQuery()<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Return</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$userOrGroup</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">LoginName<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">}</span></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt;">$GroupName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt;">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt;">EnsureLoginName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt;">"SharePoint Admins"</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";"><br /></span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> (</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: darkblue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">)<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">{<span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Write-Host</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">Url<br /></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">Set-SPOUser</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-Site</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">URL </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-IsSiteCollectionAdmin</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$true</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">-LoginName</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console";">$GroupName</span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><span style="mso-spacerun: yes;"> <br /></span></span><span style="color: black; font-family: "Lucida Console"; font-size: 9.0pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;">} </span></div><p>
<br /></p><p><b><u>Sources:</u></b></p><p></p><ul style="text-align: left;"><li><a href="https://sharepoint.stackexchange.com/questions/114421/can-i-use-set-spouser-to-set-an-o365-security-group-as-a-secondary-site-collecti">sharepoint online - Can I use Set-SPOUser to set an O365 security group as a secondary site collection administrator? - SharePoint Stack Exchange</a></li></ul><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-29592933213781659002023-01-04T05:48:00.004-08:002023-01-04T07:01:59.954-08:00SharePoint Online: Empty Recycle Bin using PowerShell<p></p><p style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IfV0RmiZK1lT6hKT1GZB-Xrgqr3fJZBjjX2GwxvMLJjaPyaqF_qe2Ifcd3ZXNitpb8aIRQiEF2eL96SmfTHCF7jG9OaCiZaeSPKurSl7ALDHJdiDPrOzBtfyW9I4Ip8QyhcDYJS2kcIqK-TugGE4waN4vLMlBrOJ9yeZrwcRcxhfMLHPU4zSN0pb2Q/s614/Logo-Final-Sharepoint-1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IfV0RmiZK1lT6hKT1GZB-Xrgqr3fJZBjjX2GwxvMLJjaPyaqF_qe2Ifcd3ZXNitpb8aIRQiEF2eL96SmfTHCF7jG9OaCiZaeSPKurSl7ALDHJdiDPrOzBtfyW9I4Ip8QyhcDYJS2kcIqK-TugGE4waN4vLMlBrOJ9yeZrwcRcxhfMLHPU4zSN0pb2Q/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></p><br />Here is a PowerShell script to empty the recycle bin for all SharePoint Online sites that are in a CSV file using the PNP module. I created this by tweaking the script found here: <a href="https://www.sharepointdiary.com/2016/06/sharepoint-online-powershell-to-empty-recycle-bin.html">SharePoint Online: Empty Recycle Bin using PowerShell - SharePoint Diary</a><p style="text-align: left;"></p><div style="text-align: left;"><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in; text-align: left;"><div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><#<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Empty
the Recycle Bin for SharePoint Online Sites<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Author:
Tom DeMeulenaere - Jan 4, 2023<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-
This Script uses the SharePoint online PNP module to connect to each sharepoint
url in a CSV and cycles through to empty the 1st and 2nd stage recycle bins</span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><br /> </span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Source:
https://www.sharepointdiary.com/2016/06/sharepoint-online-powershell-to-empty-recycle-bin.html<br /></span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#><br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="background-color: #fcff01;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"https://contoso-admin.sharepoint.com"<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Import-CSV</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\SWSetup\SharepointSites.csv<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AcctName</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span></span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"><span style="background-color: #fcff01;">"my.account@contoso.com"</span><br /></span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Interactive<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Function</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Empty-RecycleBin</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">){<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#Connect to Tenant Admin Site<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Connect-PnPOnline</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">URL
</span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Interactive<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Started Recycle Bin Empty for "</span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">URL </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Green<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> <br /> </span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#Empty Reycle Bins: Both 1st stage and 2nd Stage (For Recycle
Bins with less than 5000 items)<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">try</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">{</span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Clear-PnPRecycleBinItem</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-All</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Force</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">catch</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="background-color: white; color: #006161; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Microsoft.SharePoint.Client.ServerException</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">]</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">{<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkgreen; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">#Get recycle bin items in batches and delete them permanently
(For Recycle Bins that have 5000+ items)<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">While</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">( (</span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-PnPRecycleBinItem</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-RowLimit</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">500</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">) </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-ne</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$null</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">){</span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-PnPRecycleBinItem</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-RowLimit</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">500</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Clear-PnPRecycleBinItem</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Force</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">catch</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">[</span><span style="background-color: white; color: #006161; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Microsoft.SharePoint.Client.ClientRequestException</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">]</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">{<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Set-SPOUser</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Site</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">URL </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-IsSiteCollectionAdmin</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$true</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-LoginName</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$AcctName<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Empty-RecycleBin</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$url</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">)<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> }<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">}<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";"> <br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">foreach</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkblue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">in</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">)<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">{<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$start</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Empty-RecycleBin</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">URL)<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Write-host</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"Completed Recycle Bin Empty for "</span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$s</span><span style="background-color: white; color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">URL</span><span style="background-color: white; color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"
Time Elapsed: "</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">(</span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">New-TimeSpan</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Start</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$start</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-End</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> (</span><span style="background-color: white; color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-Date</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">)) </span><span style="background-color: white; color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-f</span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="background-color: white; color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Yellow<br /></span><span style="background-color: white; font-family: "Lucida Console"; font-size: 9pt;">} </span></div>
<p class="MsoNormal" style="background-color: white; line-height: normal; margin-bottom: 0in;"><o:p> </o:p></p></div><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: black; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console"; mso-color-alt: windowtext;"><br /></span></div>
<br /></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><br /></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-83278561673171892792022-12-16T07:36:00.005-08:002022-12-16T07:42:43.530-08:00Get SharePoint Online site info to CSV report using PowerShell<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPzXf1WAi5xcHhz7T__1ktlXlSLuApHf4xwPVJcBmdJOD7y0gaqWcHNzlkP5DGk1FXggO2jLnlz4t5NpNLz9Tt75xbJ0qauBdeZMgIthKRGVlNxea804YylxotugtUcwyhGGAGdYdu3qU6BCYeLQnCAyRPl6yuDggu8WP2cqgmO5ayqRRdY3yW8Rhlpg/s614/Logo-Final-Sharepoint-1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="614" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPzXf1WAi5xcHhz7T__1ktlXlSLuApHf4xwPVJcBmdJOD7y0gaqWcHNzlkP5DGk1FXggO2jLnlz4t5NpNLz9Tt75xbJ0qauBdeZMgIthKRGVlNxea804YylxotugtUcwyhGGAGdYdu3qU6BCYeLQnCAyRPl6yuDggu8WP2cqgmO5ayqRRdY3yW8Rhlpg/s320/Logo-Final-Sharepoint-1.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;">Here is a simple script to get storage info from all sites on your SharePoint Online tenant, exported to a CSV file so that you can analyze it in Excel or Power BI. All it takes is modifying the SPAdminURL variable, log in and then run this script:</div><div class="separator" style="clear: both; text-align: left;"><br /></div><p></p><div class="separator" style="clear: both;"><div style="background: white; line-height: normal; margin-bottom: 0in; text-align: left;"><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">"https://contoso-admin.sharepoint.com"<br /></span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Connect-SPOService</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Url</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$SPAdminURL<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Get-SPOSite</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Limit</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">ALL</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Select</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Url</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Title</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">GroupId</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">LastContentModifiedDate</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Status</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> @{N</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="color: darkred; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">'StorageUsageGB'</span><span style="font-family: "Lucida Console"; font-size: 9pt;">;E</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">=</span><span style="font-family: "Lucida Console"; font-size: 9pt;">{</span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$_</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">.</span><span style="font-family: "Lucida Console"; font-size: 9pt;">StorageUsageCurrent</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">/</span><span style="color: purple; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">1024</span><span style="font-family: "Lucida Console"; font-size: 9pt;">}}</span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">,</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">IsTeamsConnected, Owner<br /></span><span style="color: #a82d00; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">$siteInfo</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: dimgrey; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">|</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blue; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">Export-Csv</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-Path</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: blueviolet; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">C:\temp\SPOSiteInfo.csv</span><span style="font-family: "Lucida Console"; font-size: 9pt;"> </span><span style="color: navy; font-family: "Lucida Console"; font-size: 9pt; mso-bidi-font-family: "Lucida Console";">-NoTypeInformation <o:p></o:p></span></div>
</div><p></p><div class="separator" style="clear: both; text-align: left;"><br /></div>If you want to add more properties, here is a list of items that you can add to the Select statement:<p></p><div style="text-align: left;">LastContentModifiedDate<br />Status<br />ResourceUsageCurrent<br />ResourceUsageAverage<br />StorageUsageCurrent<br />LockIssue<br />WebsCount<br />CompatibilityLevel<br />DisableSharingForNonOwnersStatus<br />HubSiteId<br />IsHubSite<br />RelatedGroupId<br />GroupId<br />Url<br />LocaleId<br />LockState<br />Owner<br />StorageQuota<br />StorageQuotaWarningLevel<br />ResourceQuota<br />ResourceQuotaWarningLevel<br />Template<br />Title<br />AllowSelfServiceUpgrade<br />DenyAddAndCustomizePages<br />PWAEnabled<br />SharingCapability<br />SiteDefinedSharingCapability<br />SandboxedCodeActivationCapability<br />DisableCompanyWideSharingLinks<br />DisableAppViews<br />DisableFlows<br />AuthenticationContextName<br />StorageQuotaType<br />RestrictedToGeo<br />ShowPeoplePickerSuggestionsForGuestUsers<br />SharingDomainRestrictionMode<br />SharingAllowedDomainList<br />SharingBlockedDomainList<br />ConditionalAccessPolicy<br />AllowDownloadingNonWebViewableFiles<br />LimitedAccessFileType<br />AllowEditing<br />SensitivityLabel<br />CommentsOnSitePagesDisabled<br />SocialBarOnSitePagesDisabled<br />DefaultSharingLinkType<br />DefaultLinkPermission<br />DefaultLinkToExistingAccess<br />AnonymousLinkExpirationInDays<br />OverrideTenantAnonymousLinkExpirationPolicy<br />ExternalUserExpirationInDays<br />OverrideTenantExternalUserExpirationPolicy<br />SharingLockDownEnabled<br />SharingLockDownCanBeCleared<br />InformationSegment<br />InformationBarriersMode<br />BlockDownloadLinksFileType<br />OverrideBlockUserInfoVisibility<br />IsTeamsConnected<br />IsTeamsChannelConnected<br />TeamsChannelType<br />MediaTranscription<br />ExcludedBlockDownloadGroupIds<br />ExcludeBlockDownloadPolicySiteOwners<br />BlockDownloadPolicy<br />LoopSharingCapability<br />LoopOverrideSharingCapability<br />LoopDefaultSharingLinkScope<br />LoopDefaultSharingLinkRole<br />RequestFilesLinkEnabled<br />RequestFilesLinkExpirationInDays<br />OverrideSharingCapability<br />DefaultShareLinkScope<br />DefaultShareLinkRole<br />ReadOnlyForUnmanagedDevices<br />RestrictedAccessControl</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Resources:</div><div style="text-align: left;"><ul style="text-align: left;"><li><a href="https://www.ntweekly.com/2021/08/01/list-all-sharepoint-online-sites-and-size-with-powershell/#:~:text=List%20All%20SharePoint%20Online%20Sites%20and%20Size%20With,...%203%20List%20All%20Sites%20and%20Size%20" target="_blank">https://www.ntweekly.com/2021/08/01/list-all-sharepoint-online-sites-and-size-with-powershell/#:~:text=List%20All%20SharePoint%20Online%20Sites%20and%20Size%20With,...%203%20List%20All%20Sites%20and%20Size%20</a><br /></li></ul></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-2740537947508983052022-10-14T12:00:00.005-07:002022-10-14T12:00:36.278-07:00PowerShell to get CSV export of Active Directory<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWNfb8giR7hLIyNyVV54quEucUF2YbI0JR4YuHKhN070z11dZi-8Xs6dT_CDf0S6yLZwZZHyuCB8DzPXHms_p4jXwnSmbj4px08xJMXbyIgMRmlfQ0xjuFj_vLoIA48D1HAx0Vf4uk2PE5NlmwHgEqjca82Su0KKZc03N6SDEVZkWM5S91zz2uIvXVig/s937/active-directory-logo-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="937" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWNfb8giR7hLIyNyVV54quEucUF2YbI0JR4YuHKhN070z11dZi-8Xs6dT_CDf0S6yLZwZZHyuCB8DzPXHms_p4jXwnSmbj4px08xJMXbyIgMRmlfQ0xjuFj_vLoIA48D1HAx0Vf4uk2PE5NlmwHgEqjca82Su0KKZc03N6SDEVZkWM5S91zz2uIvXVig/s320/active-directory-logo-1.png" width="320" /></a></div><p><br /></p>A quick note on a script I threw together on exporting user information from Active Directory. The old script I was using stopped working, so I needed to rework it. Here is what I came up with:<p></p><span><a name='more'></a></span><p>Import-Module ActiveDirectory</p><div style="text-align: left;">$path = Split-Path -parent "C:\Users\[user]\Downloads\*.*"<br />$LogDate = get-date -f yyyyMMddhhmm<br />$csvfile = $path + "\ALLADUsers_$logDate.csv"</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><div>Get-ADUser -Filter "Enabled -eq 'TRUE' -and employeeType -eq 'Employee'" -Properties displayname, employeeType, enabled, givenname, sn, manager, mail, streetaddress, city, st, postalcode, co, telephonenumber, mobile, ipphone, homephone, extensionattribute2, extensionattribute3, extensionattribute4,</div><div>company, department, extensionattribute1, title, physicaldeliveryofficename | Select-Object displayname, employeeType, enabled, givenname, sn, mail, streetaddress, city, st, postalcode, co, telephonenumber, mobile, ipphone, homephone, extensionattribute2, extensionattribute3, extensionattribute4, company, department, extensionattribute1, title, physicaldeliveryofficename, @{Label = "Manager";Expression = {%{(Get-AdUser $_.Manager -Properties DisplayName).DisplayName}}} | export-csv $csvfile -NoTypeInformation</div><div><br /></div><div><b><u>Sources</u></b></div><div><ul style="text-align: left;"><li><a href="https://learn.microsoft.com/en-us/powershell/module/activedirectory/get-aduser?view=winserver2012r2-ps&redirectedfrom=MSDN">Get-ADUser (ActiveDirectory) | Microsoft Learn</a></li><li><a href="https://social.technet.microsoft.com/wiki/contents/articles/12037.active-directory-get-aduser-default-and-extended-properties.aspx">Active Directory: Get-ADUser Default and Extended Properties - TechNet Articles - United States (English) - TechNet Wiki (microsoft.com)</a></li><li><a href="https://shellgeek.com/get-aduser-all-properties-in-powershell/">Get AdUser All Properties in PowerShell - ShellGeek</a></li><li><a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/where-object?view=powershell-7.2">Where-Object (Microsoft.PowerShell.Core) - PowerShell | Microsoft Learn</a></li></ul></div></div><p><br /></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-24171192997014374492022-08-29T10:29:00.007-07:002022-08-29T10:32:13.684-07:00Power Query - Date is within the last 18 Months Custom Column <p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhONVjvUhtpFJkFQnoVnqNVLFmI3JHryLMK9ELCi28qXYDJia3l64-A-sN7BZcMfyGh9EpxyyS2YsBY4u-DnIGajuE_Aak9wEilDhPXRgTgv4oW9Bl5YdiR6unxH9zyERa4BpGzdADTDEE8tIKnh-Iqp8c6mdnOvMLp5mL5GArTvDeF3BDTdH8klTDWLA/s1900/pbi%20banner.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="737" data-original-width="1900" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhONVjvUhtpFJkFQnoVnqNVLFmI3JHryLMK9ELCi28qXYDJia3l64-A-sN7BZcMfyGh9EpxyyS2YsBY4u-DnIGajuE_Aak9wEilDhPXRgTgv4oW9Bl5YdiR6unxH9zyERa4BpGzdADTDEE8tIKnh-Iqp8c6mdnOvMLp5mL5GArTvDeF3BDTdH8klTDWLA/w640-h248/pbi%20banner.jpg" width="640" /></a></div><br /> Here are directions on how to create a custom column in Power BI, Power Query that tells you if a date is within the last 18 months.<p></p><p>if DateTime.Date(DateTime.LocalNow())<Date.AddMonths([Release Date],18) then "Compliant" else "Noncompliant"</p><p>The number can be changed so that it fits your needs.</p><p>On a different note, if you wanted to compare a date to see if it is within the current year, this would be the code you would use to create a custom column:</p><p>if Number.From(Date.Year(DateTime.LocalNow()))=[Release Year] then "Compliant" else "Noncompliant"</p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-60658698252111823332022-08-29T10:12:00.001-07:002022-08-29T10:30:21.849-07:00Power BI Reverse Slicer<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLzQEMJ-hDAqBXh0H3u9M7oWfIniVHtOBF3oXr_m4OXUcYLWsb4kr2e940V7Mm6R9IuSZR4Pa_9PdB9DfqJo67otJlMQwEBVBWLQB2qs_e-dZFz8p5pVq-TaaaXX5U1Z9DeluG2pru7LAR4gN8W58QHOes4g-ZCP6TJd1pDkjDXXnk5S3lLi2Ivh6nNQ/s1280/SCCM02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="641" data-original-width="1280" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLzQEMJ-hDAqBXh0H3u9M7oWfIniVHtOBF3oXr_m4OXUcYLWsb4kr2e940V7Mm6R9IuSZR4Pa_9PdB9DfqJo67otJlMQwEBVBWLQB2qs_e-dZFz8p5pVq-TaaaXX5U1Z9DeluG2pru7LAR4gN8W58QHOes4g-ZCP6TJd1pDkjDXXnk5S3lLi2Ivh6nNQ/s320/SCCM02.png" width="320" /></a></div><br /> Sometimes you want to filter things based on the reverse of a slicer you made. <a href="https://datakuity.com/2019/06/13/power-bi-exclude-data-based-on-slicer-selection/" target="_blank">This blog post</a> tells you how to do it, but I'm going to put my own twist on it, so that it can be used with a table.<p></p><p><br /></p><h2 style="background-color: white; box-sizing: border-box; clear: both; color: #212121; font-family: Lato, sans-serif; font-size: 30px; font-weight: 400; line-height: 1.1; margin-bottom: 10px; margin-top: 20px; overflow-wrap: break-word; text-align: justify;">Power BI Exclude data based on Slicer selection<span class="ez-toc-section-end" style="box-sizing: border-box;"></span></h2><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;">In other words, we want to use a slicer to exclude some data and display all the others.</p><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><strong style="box-sizing: border-box;">Step 1:</strong><br style="box-sizing: border-box;" />First, we need to create a disconnected dimension which will be a copy of the dimension used as a slicer, “DimSalesTerritory” in my case.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC-EPrIuUoIBjEMOwnw6hcfhlSaPSn8kffHdElWVSNYWErIoiXa_fwkZ8qN9kmPg8EI6h-ZA0y9nsYHzNmDEpeVxoJeK2Zuo0TEqIYcjkZ0sdCbIgvM4Z2ey4TDWRteZbAly9Fg3Ly9m1A2Ptlf-vBMN_Qk1ZKANI7_ssQoYu4RBM2EdxE5flw61-L-g/s1167/capture-7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="1167" height="276" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC-EPrIuUoIBjEMOwnw6hcfhlSaPSn8kffHdElWVSNYWErIoiXa_fwkZ8qN9kmPg8EI6h-ZA0y9nsYHzNmDEpeVxoJeK2Zuo0TEqIYcjkZ0sdCbIgvM4Z2ey4TDWRteZbAly9Fg3Ly9m1A2Ptlf-vBMN_Qk1ZKANI7_ssQoYu4RBM2EdxE5flw61-L-g/w640-h276/capture-7.png" width="640" /></a></div><br /><figure class="wp-block-image" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; margin: 0px 0px 1em; text-align: justify;"><br /></figure><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><strong style="box-sizing: border-box;">Step 2:</strong><br style="box-sizing: border-box;" />We then need to create a measure “isExclude” that will be used to find out which rows should be excluded if any.</p><p style="box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><span style="background-color: #fcff01;">(Create this measure in the disconnected table)</span></p><div class="wp-block-syntaxhighlighter-code brush: sql; notranslate" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; text-align: justify;"><div style="box-sizing: border-box;"><div class="syntaxhighlighter dax" id="highlighter_392963" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto hidden !important; padding: 0.5em 1em !important; position: relative !important; width: 703.5px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; table-layout: auto !important; vertical-align: baseline !important; width: 667.5px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: auto !important;"><tr style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">1</div><div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">2</div><div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">3</div><div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">4</div><div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">5</div><div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">6</div><div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">7</div><div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">8</div><div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">9</div></td><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: 627.594px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">isExclude </code><code class="dax operator" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">=</code></div><div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">IF</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code></div><div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">MAX</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">DimSalesTerritory[SalesTerritoryRegion]</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code> <code class="dax operator" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">IN</code></div><div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">ALLSELECTED</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">'Disconected DimSalesTerritory'[SalesTerritoryRegion]</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code></div><div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">&& </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">COUNTROWS</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">ALLSELECTED</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">'Disconected DimSalesTerritory'</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code> <code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"><></code></div><div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">COUNTROWS</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">ALL</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">'Disconected DimSalesTerritory'</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">,</code></div><div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax number" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">1</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">,</code></div><div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax number" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">0</code></div><div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code></div></div></td></tr></tbody></table></div></div></div><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;">The first condition checks which rows should be excluded and the second condition is only used to prevent the measure to exclude everything when nothing is selected.</p><p style="box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><span style="background-color: #fcff01;">Here is where what I did diverges from the blog post:</span></p><p style="box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><span style="background-color: #fcff01;">Instead of creating a measure based on the slicer list, I added </span></p><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">isExclude </code><code class="dax operator" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">=</code></span></div><div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">IF</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code></span></div><div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax spaces" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">MAX</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">FactInternetSales[SalesTerritoryKey]</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code> <code class="dax operator" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">IN</code></span></div><div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax spaces" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">ALLSELECTED</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">'Disconected DimSalesTerritory'[SalesTerritoryKey]</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code></span></div><div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax spaces" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">&& </code><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">COUNTROWS</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">ALLSELECTED</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">'Disconected DimSalesTerritory'</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code> <code class="dax plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"><></code></span></div><div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax spaces" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">COUNTROWS</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">ALL</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">'Disconected DimSalesTerritory'</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">,</code></span></div><div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax spaces" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax number" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">1</code><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">,</code></span></div><div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><span style="background-color: #fcff01;"><code class="dax spaces" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax number" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">0</code></span></div><div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax parenthesis" style="background-attachment: initial !important; background-clip: initial !important; background-color: #fcff01; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code></div><p style="box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><span style="background-color: #fcff01;"><br /></span></p><p style="box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><span style="background-color: #fcff01;">Then, put the sales region from the disconnected table in a slicer</span></p><p style="box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><span style="background-color: #fcff01;">And finally, put a filter in the table visualization that says "isExclude is not 1"</span></p><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;">To follow the rest of the blog post: </p><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><strong style="box-sizing: border-box;">Step 3:</strong><br style="box-sizing: border-box;" />Now we can create a new measure “Sales Amount (Disconnected)” which will sum up the SalesAmount for all the regions that are not excluded.</p><div class="wp-block-syntaxhighlighter-code brush: sql; notranslate" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; text-align: justify;"><div style="box-sizing: border-box;"><div class="syntaxhighlighter dax" id="highlighter_181210" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto hidden !important; padding: 0.5em 1em !important; position: relative !important; width: 703.5px;"><table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; table-layout: auto !important; vertical-align: baseline !important; width: 667.5px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: auto !important;"><tr style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">1</div><div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">2</div><div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">3</div><div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">4</div><div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">5</div><div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">6</div><div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">7</div><div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">8</div><div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">9</div><div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">10</div><div class="line number11 index10 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-color: initial !important; border-bottom-style: initial !important; border-image: initial !important; border-left-color: initial !important; border-left-style: initial !important; border-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-color: initial !important; border-top-style: initial !important; border-width: 0px 3px 0px 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px 1em 0px 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 0px !important; position: static !important; text-align: right !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">11</div></td><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; width: 617.703px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">Sales Amount </code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">Disconected</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code> <code class="dax operator" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">=</code></div><div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">VAR</code> <code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">FilterRegions </code><code class="dax operator" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">=</code></div><div class="line number3 index2 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">FILTER</code> <code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code></div><div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">FactInternetSales</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">,</code></div><div class="line number5 index4 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax measures" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">[isExclude]</code> <code class="dax operator" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">=</code><code class="dax number" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">0</code></div><div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code></div><div class="line number7 index6 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">RETURN</code></div><div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">CALCULATE</code> <code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code></div><div class="line number9 index8 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax functions" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">sum</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">(</code><code class="dax columns" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">FactInternetSales[SalesAmount]</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">,</code></div><div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">FilterRegions</code></div><div class="line number11 index10 alt2" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;"><code class="dax spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;"> </code><code class="dax parenthesis" style="background: none !important; border-radius: 0px !important; border: 0px !important; box-shadow: none !important; box-sizing: content-box !important; color: #666666; direction: ltr !important; display: inline !important; float: none !important; font-family: Monaco, Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; height: auto !important; inset: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; vertical-align: baseline !important; white-space: normal; width: auto !important;">)</code></div></div></td></tr></tbody></table></div></div></div><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><strong style="box-sizing: border-box;">Step 4:</strong><br style="box-sizing: border-box;" />All right, you should be all set up now now.<br style="box-sizing: border-box;" />As we can see on the visuals below when we select Australia from the slicer all the other regions appart from Australia are displayed.</p><figure class="wp-block-image" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; margin: 0px 0px 1em; text-align: justify;"><img alt="Power BI Exclude data based on Slicer selection" class="wp-image-785" height="255" loading="lazy" sizes="(max-width: 743px) 100vw, 743px" src="https://benfedit.files.wordpress.com/2019/06/capture-8.png" srcset="https://datakuity.com/wp-content/uploads/2019/06/capture-8.png 743w, https://datakuity.com/wp-content/uploads/2019/06/capture-8-300x103.png 300w" style="border-radius: inherit; border: 0px; box-sizing: border-box; height: auto; margin-bottom: 1em; max-width: 100%; vertical-align: bottom; width: auto;" width="743" /></figure><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><strong style="box-sizing: border-box;">Step 4 bis:</strong><br style="box-sizing: border-box;" />If instead of creating a new measure you want the “Exclude Slicer” to work on your visual for any measures you just need to add the “isExclude” measure into the visual filter pane.</p><figure class="wp-block-image" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; margin: 0px 0px 1em; text-align: justify;"><img alt="" class="wp-image-786" height="290" loading="lazy" src="https://benfedit.files.wordpress.com/2019/06/capture-9.png" style="border-radius: inherit; border: 0px; box-sizing: border-box; height: auto; margin-bottom: 1em; max-width: 100%; vertical-align: bottom; width: auto;" width="192" /></figure><figure class="wp-block-image" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; margin: 0px 0px 1em; text-align: justify;"><br /></figure><figure class="wp-block-image" style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; margin: 0px 0px 1em; text-align: justify;">Source: <a href="https://datakuity.com/2019/06/13/power-bi-exclude-data-based-on-slicer-selection/" target="_blank">https://datakuity.com/2019/06/13/power-bi-exclude-data-based-on-slicer-selection/</a></figure><p style="background-color: white; box-sizing: border-box; color: #424242; font-family: "Source Sans Pro", sans-serif; font-size: 18px; line-height: 1.7em; margin: 0px 0px 1.5em; overflow-wrap: break-word; text-align: justify;"><br /></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-58296119228931444322022-08-11T07:23:00.003-07:002022-08-11T07:24:31.879-07:00Reset Windows Updates using a batch file<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN-PS04dyqbGA461UTUZe6HluO5_iYE0EjBsshN6Gc5FQAgGzZ3Y3UOiaBmd3PJC2sFnaMSQraPIaJtbMPJd5wwvuf9xjfu8Kxc1Y7nBGTqEIQ3XfC_3nGZYqJD4HdSgG4wFQSFyrDxrJ-V--k0TaXvnsyeHiHlCbf91otut58CWOxneQ7HpL4XhhwvQ/s1998/background%20-%20Greece.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1125" data-original-width="1998" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN-PS04dyqbGA461UTUZe6HluO5_iYE0EjBsshN6Gc5FQAgGzZ3Y3UOiaBmd3PJC2sFnaMSQraPIaJtbMPJd5wwvuf9xjfu8Kxc1Y7nBGTqEIQ3XfC_3nGZYqJD4HdSgG4wFQSFyrDxrJ-V--k0TaXvnsyeHiHlCbf91otut58CWOxneQ7HpL4XhhwvQ/s320/background%20-%20Greece.jpg" width="320" /></a></div><br /><p></p><p>Sometimes updates get hung up, or won't install from the SCCM software center. You will need to reset Windows Updates. You can do this manually, or with a batch file script</p><div style="text-align: left;"><span style="font-family: courier;">net stop wuauserv<br />net stop cryptSvc<br />net stop bits<br />net stop msiserver<br />ren C:\Windows\SoftwareDistribution SoftwareDistribution.old<br />ren C:\Windows\System32\catroot2 catroot2.old<br />net start wuauserv<br />net start cryptSvc<br />net start bits<br />net start msiserver</span></div><div style="text-align: left;"><span style="font-family: courier;"><br /></span></div><div style="text-align: left;"><span style="font-family: inherit;">If that doesn't work, try this:</span></div><div style="text-align: left;"><span style="font-family: inherit;"><br /></span></div><div style="text-align: left;"><div><span style="font-family: courier;">Net stop bits</span></div><div><span style="font-family: courier;">Net stop wuauserv</span></div><div><span style="font-family: courier;">Net stop appidsvc</span></div><div><span style="font-family: courier;">Net stop cryptsvc</span></div><div><span style="font-family: courier;">Del %ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat /Q</span></div><div><span style="font-family: courier;">Del "%HOMEDRIVE%\Users\All Users\Microsoft\Network\Downloader\qmgr*.dat" /Q</span></div><div><span style="font-family: courier;">Del %WINDIR%\SoftwareDistribution\*.* /s /Q</span></div><div><span style="font-family: courier;">Net start bits</span></div><div><span style="font-family: courier;">Net start wuauserv</span></div><div><span style="font-family: courier;">Net start appidsvc</span></div><div><span style="font-family: courier;">Net start cryptsvc</span></div><div><span style="font-family: courier;">Pause</span></div></div>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-51154631578079343462022-07-29T07:50:00.000-07:002022-07-29T07:50:06.934-07:00SCCM - Running all updates on a server through the SCCM console<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn6HX74ml4TX2nGR4EpUfprGJu01BBMeeJbnGl-qJ1aF1Mva75PoDtIo2ITrAvCLojjrHaxaVj7-a91VJwRL8Lmh87dCLE4gXk2XPDxjOgsLZ8Gwv24n9Y9rkn2_R3eGIj6JR-TX7TS5tCPF4LWZPKNfInqZ5eSQsNM2iAD3dOEnVfSuToQlwtHUPzHQ/s1280/SCCM02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="641" data-original-width="1280" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn6HX74ml4TX2nGR4EpUfprGJu01BBMeeJbnGl-qJ1aF1Mva75PoDtIo2ITrAvCLojjrHaxaVj7-a91VJwRL8Lmh87dCLE4gXk2XPDxjOgsLZ8Gwv24n9Y9rkn2_R3eGIj6JR-TX7TS5tCPF4LWZPKNfInqZ5eSQsNM2iAD3dOEnVfSuToQlwtHUPzHQ/w400-h200/SCCM02.png" width="400" /></a></div><p style="text-align: left;"><span style="font-family: inherit;">In a <a href="https://tdemeul.bunnybesties.org/2020/08/sccm-install-available-updates-on-list.html" target="_blank">previous post</a>, I wrote about how to run all updates on a list of servers. Since then, I've refined my process to do it through the SCCM console. The benefit is that </span></p><div style="text-align: left;"><p style="text-align: left;"></p><ul style="text-align: left;"><li><span style="font-family: inherit;">I can run the script on computers on different domains, </span></li></ul><ul style="text-align: left;"><li><span style="font-family: inherit;">on computers that are in Workgroups, </span></li></ul><ul style="text-align: left;"><li><span style="font-family: inherit;">and computers that can't be reached because of firewall rules. </span></li></ul><p></p></div><span style="font-family: inherit;">If the SCCM client is installed on these computers, then this method will get around all of these scenarios. <br /></span><h1 style="text-align: left;"><span style="font-family: inherit;">Create the Script</span></h1><span style="font-family: inherit;">In SCCM, navigate to Software Library > </span>Scripts<span style="font-family: inherit;"> and create a new </span>PowerShell<span style="font-family: inherit;"> script using this code, and approve it. You will need to change the log path below in yellow.</span><p></p><div style="text-align: left;"><span style="font-size: x-small;"><#<br /></span><span style="font-size: x-small;">AUTHOR : Eswar Koneti <br /></span><span style="font-size: x-small;">DATE : 14-Nov-2016<br /></span><span style="font-size: x-small;">COMMENT : This script check and install the software updates available in<br /></span><span style="font-size: x-small;"> software center on clients remotely with nice logging info<br /></span><span style="font-size: x-small;">VERSION : 1.0<br /></span><span style="font-size: x-small;">#></span><span style="font-size: x-small;"><br /></span><span style="font-size: x-small;"># Determine script location<br /></span><span style="font-size: x-small;">$system = "$env:computername"<br /></span><span style="font-size: x-small;">$log = <span style="background-color: #fcff01;">"\\CONTOSOSERVER01\Updates Log\InstallUpdates-$system.log</span>"<br /></span><span style="font-size: x-small;">$date = Get-Date -Format "dd-MM-yyyy hh:mm:ss"<br /></span><span style="font-size: x-small;"># Get list of clients from notepad<br /></span><span style="font-size: x-small;">"--------------------- Script executed on $date (DD-MM-YYYY hh:mm:ss) ---------------------" + "`r`n" | Out-File $log -append</span><span style="font-size: x-small;"><br /></span><span style="font-size: x-small;"><br /></span><span style="font-size: x-small;"># Get list of all instances of CCM_SoftwareUpdate from root\CCM\ClientSDK for missing updates https://msdn.microsoft.com/en-us/library/jj155450.aspx?f=255&MSPPError=-2147217396<br /></span><span style="font-size: x-small;">$TargetedUpdates= Get-WmiObject -Namespace root\CCM\ClientSDK -Class CCM_SoftwareUpdate -Filter ComplianceState=0<br /></span><span style="font-size: x-small;">$approvedUpdates= ($TargetedUpdates |Measure-Object).count<br /></span><span style="font-size: x-small;">$pendingpatches=($TargetedUpdates |Where-Object {$TargetedUpdates.EvaluationState -ne 8} |Measure-Object).count<br /></span><span style="font-size: x-small;">$rebootpending=($TargetedUpdates |Where-Object {$TargetedUpdates.EvaluationState -eq 8} |Measure-Object).count<br /></span><span style="font-size: x-small;">if ($pendingpatches -gt 0) <br /></span><span style="font-size: x-small;">{<br /></span><span style="font-size: x-small;"> try {<br /></span><span style="font-size: x-small;"><span style="white-space: pre;"> </span>$MissingUpdatesReformatted = @($TargetedUpdates | ForEach-Object {if($_.ComplianceState -eq 0){[WMI]$_.__PATH}}) <br /></span><span style="font-size: x-small;"><span style="white-space: pre;"> </span># The following is the invoke of the CCM_SoftwareUpdatesManager.InstallUpdates with our found updates <br /></span><span style="font-size: x-small;"><span style="white-space: pre;"> </span>$InstallReturn = Invoke-WmiMethod -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList (,$MissingUpdatesReformatted) -Namespace root\ccm\clientsdk <br /></span><span style="font-size: x-small;"><span style="white-space: pre;"> </span>"$system,Targeted Patches :$approvedUpdates,Pending patches:$pendingpatches,Reboot Pending patches :$rebootpending,initiated $pendingpatches patches for install" | Out-File $log -append<br /></span><span style="font-size: x-small;"><span style="white-space: pre;"> </span> }<br /></span><span style="font-size: x-small;"><span style="white-space: pre;"> </span>catch {"$System,pending patches - $pendingpatches but unable to install them ,please check Further" | Out-File $log -append }<br /></span><span style="font-size: x-small;">}<br /></span><span style="font-size: x-small;">else {"$system,Targeted Patches :$approvedUpdates,Pending patches:$pendingpatches,Reboot Pending patches :$rebootpending,Compliant" | Out-File $log -append }</span></div><h1 style="text-align: left;">Create a Server Device Collection</h1><div style="text-align: left;">Every time I run this, I need to check to see that the group of servers I'm updating hasn't changed. Some may have been added to the environment, deleted, or switched to a different update group. I go to our server spreadsheet and copy/paste them into the text file I'm going to use. One server per line.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Next, I open the SCCM console, go to my server update group, and remove all machines from the group.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Then, I open up a SCCM PowerShell prompt from the blue dropdown arrow menu in the top left of the console. </div><div style="text-align: left;"><br /></div><div style="text-align: left;">Then I run this script (You will need to replace the names of the text file and device collection name in yellow below):</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Get-Content "ES:\<span style="background-color: #fcff01;">Group 1 Patching.txt</span>" | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName "<span style="background-color: #fcff01;">Servers - Group 1 Patching</span>" -ResourceID (Get-CMDevice -Name $_).ResourceID }</div><div style="text-align: left;"><br /></div><div style="text-align: left;">This populates the device collection. once the servers are in there, make sure that the list is complete. You don't want to miss any servers, or run updates on a server that you aren't supposed to.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Once it looks good, right click on the device collection and run the script that installs all updates on the group.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Note: you can do this for any device collection of machines, or individual device. Creating a device collection of servers is related to monthly server patching. You could also do this with Win10/Win7 or any other windows based machines that are in SCCM. </div><p></p><p></p><p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0tag:blogger.com,1999:blog-3637902975942367273.post-31434694156867552612022-07-28T21:57:00.004-07:002022-07-29T07:26:39.301-07:00Teams creation governance example using PowerShell<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiipQz2NZeRAiw-X-7VQprJaFdTCOtW1dI4SMIFPAYedrF3ZQcHIC7qJnmfpEThotIRIX1mKhG-TvLCARQerFxJAvoFnZMNCrrdKZfDXywXfrY1kTb7BikcZP2hyJZ021uhGP2MIujOrRUobFQX5ERzznhdJ9VW7wgful4bkGpfszNWBr0V4bSsUWBu4Q/s909/teamsheader.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="511" data-original-width="909" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiipQz2NZeRAiw-X-7VQprJaFdTCOtW1dI4SMIFPAYedrF3ZQcHIC7qJnmfpEThotIRIX1mKhG-TvLCARQerFxJAvoFnZMNCrrdKZfDXywXfrY1kTb7BikcZP2hyJZ021uhGP2MIujOrRUobFQX5ERzznhdJ9VW7wgful4bkGpfszNWBr0V4bSsUWBu4Q/w400-h225/teamsheader.jpg" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">There are a lot of different ways to govern how Teams get created. Some companies choose to allow Teams creation to everyone, opening M365 up to content sprawl and data duplication. Others lock everything down so tight that it is impossible to use. In my job, I created a way that I would like to think spilts the difference. This method</div><div class="separator" style="clear: both; text-align: left;"><ul style="text-align: left;"><li>Locks down group creation, but allows anyone to request a Team</li><li>Team creation is done with approval</li><li>Teams are created automatically after approval using PowerShell</li></ul><div>This is what I did to set that up:</div><h2 style="text-align: left;">Lock Down M365 group creation</h2><div>The first step is to lock down M365 group creation to a small group of people. I chose to do the IT department, but you can go as large or small as you want. Just make sure that the Teams Admin service account that you use in the PowerShell script is allowed to make M365 groups.</div><div>The process to lock down group creation is detailed here: </div><div><a href="https://docs.microsoft.com/en-us/microsoft-365/solutions/manage-creation-of-groups?view=o365-worldwide">https://docs.microsoft.com/en-us/microsoft-365/solutions/manage-creation-of-groups?view=o365-worldwide</a></div><h2 style="text-align: left;">Create a PowerShell Script</h2><div>Copy this PowerShell script and save it as a .ps1 file. You will need to change the variables that are highlighted in yellow below.</div><div><br /></div><div style="text-align: left;"><p><span style="font-family: courier; font-size: x-small;">Install-Module -Name MicrosoftTeams -Force -AllowClobber<br /></span><span style="font-family: courier; font-size: x-small;">$username = "<span style="background-color: #fcff01;">TeamsAdmin@contoso.com</span>"<br /></span><span style="font-family: courier; font-size: x-small;">$password = ConvertTo-SecureString "<span style="background-color: #fcff01;">TeamsAdminPassword</span>” -AsPlainText -Force<br /></span><span style="font-family: courier; font-size: x-small;">$psCred = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password)<br /></span><span style="font-family: courier; font-size: x-small;">Connect-MicrosoftTeams -credential $psCred</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamFocus = "Department"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamDept = "Accounting"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamProject = "Accounts Payable"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamDescription = "Description for the Team " + $TeamDept +", "+$TeamProject<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamVisibility = "Public" # or "Private"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamOwner1 = "TeamsAdmin@contoso.com"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamOwner2 = "bob@contoso.com"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamOwner3 = "sara@contoso.com"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamChannel1 = "Team 1"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamChannel2 = "Team 2"<br /></span><span style="background-color: #fcff01; font-family: courier; font-size: x-small;">$TeamChannel3 = "Team 3"</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">if($TeamFocus -eq "Department"){<br /></span><span style="font-family: courier; font-size: x-small;"> $TeamName = "Dept "+$TeamDept +" "+$TeamProject<br /></span><span style="font-family: courier; font-size: x-small;">}<br /></span><span style="font-family: courier; font-size: x-small;">elseif($TeamFocus -eq "Project"){<br /></span><span style="font-family: courier; font-size: x-small;"> $TeamName = "Proj " + $TeamProject<br /></span><span style="font-family: courier; font-size: x-small;">}<br /></span><span style="font-family: courier; font-size: x-small;">else{<br /></span><span style="font-family: courier; font-size: x-small;"> $TeamName = "Team " + $TeamProject<br /></span><span style="font-family: courier; font-size: x-small;">}</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">$TeamNickname = $TeamName -replace '(^\s+|\s+$)','' -replace '\s+','' -replace '&',''</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">try{$group = New-Team -DisplayName $TeamName -Description $TeamDescription -Visibility $TeamVisibility}<br /></span><span style="font-family: courier; font-size: x-small;">catch{<br /></span><span style="font-family: courier; font-size: x-small;"> $rand = Get-Random -Maximum 100<br /></span><span style="font-family: courier; font-size: x-small;"> $TeamNickname += $rand<br /></span><span style="font-family: courier; font-size: x-small;"> $TeamName = $TeamName + " " + $rand<br /></span><span style="font-family: courier; font-size: x-small;"> $group = New-Team -MailNickname $TeamNickname -DisplayName $TeamName -Description $TeamDescription -Visibility $TeamVisibility<br /></span><span style="font-family: courier; font-size: x-small;">}<br /></span><span style="font-family: courier; font-size: x-small;">finally{<br /></span><span style="font-family: courier; font-size: x-small;"> Add-TeamUser -GroupId $group.GroupId -User $TeamOwner1 -Role "owner"<br /></span><span style="font-family: courier; font-size: x-small;"> Add-TeamUser -GroupId $group.GroupId -User $TeamOwner2 -Role "owner"<br /></span><span style="font-family: courier; font-size: x-small;"> Add-TeamUser -GroupId $group.GroupId -User $TeamOwner3 -Role "owner"</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;"> if($TeamChannel1 -ne ""){<br /></span><span style="font-family: courier; font-size: x-small;"> New-TeamChannel -GroupId $group.GroupId -DisplayName $TeamChannel1<br /></span><span style="font-family: courier; font-size: x-small;"> }<br /></span><span style="font-family: courier; font-size: x-small;"> if($TeamChannel2 -ne ""){<br /></span><span style="font-family: courier; font-size: x-small;"> New-TeamChannel -GroupId $group.GroupId -DisplayName $TeamChannel2<br /></span><span style="font-family: courier; font-size: x-small;"> }<br /></span><span style="font-family: courier; font-size: x-small;"> if($TeamChannel3 -ne ""){<br /></span><span style="font-family: courier; font-size: x-small;"> New-TeamChannel -GroupId $group.GroupId -DisplayName $TeamChannel3<br /></span><span style="font-family: courier; font-size: x-small;"> }</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;"> Disconnect-MicrosoftTeams<br /></span><span style="font-family: courier; font-size: x-small;"> }</span></p></div><h2 style="text-align: left;">Set up approvals in your ticketing system</h2><div>We used SCSM for our ticketing system, and SCORCH for automation in our solution, but you can accomplish this with any modern ticketing system that includes approvals and launching PowerShell commands.</div><div>The workflow we set up was:</div><div><ol style="text-align: left;"><li>Requester creates a ticket, filling in the info needed for the PowerShell variables in the ticket.</li><li>Then the ticket goes to the requesters manager for approval</li><li>If that is approved, then it goes to IT leadership, where at least 2 leaders must approve the request.</li><li>If they approve it, then the above PowerShell command launches, with the variables populated by what the requester put into the ticket which creates the Team. The owner gets an automated email from Microsoft telling them that they have been added to the Team as an owner, and then the ticket closes.</li></ol><div>An that's it! You now have a workflow with approvals that automatically creates a Team using PowerShell.</div><div><br /></div><div><h2 style="text-align: left;">If you get errors...</h2><div>Initially I was running this off of MS Server 2016 and was getting this error:</div></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8Sk-ZCnLIl1lVTx57LJC3aE2LRIcU_mmeG0yowNicKufdieUf-zjnULUt854nkenwNJ6OKWJxd4mt7csox_jvwEH4n0JciA0IgqYeXbCm9nndX1VLLUIkiPKD8ZSu6FB32fzcWcxibxG2Wli8WK75IN8Yjr1lu2nEUHfdKK7mzp1ZQRV0b0s2amWORA/s1582/teamscreationerror.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="264" data-original-width="1582" height="106" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8Sk-ZCnLIl1lVTx57LJC3aE2LRIcU_mmeG0yowNicKufdieUf-zjnULUt854nkenwNJ6OKWJxd4mt7csox_jvwEH4n0JciA0IgqYeXbCm9nndX1VLLUIkiPKD8ZSu6FB32fzcWcxibxG2Wli8WK75IN8Yjr1lu2nEUHfdKK7mzp1ZQRV0b0s2amWORA/w640-h106/teamscreationerror.png" width="640" /></a></div>This was happening every time I tried to invoke New-Team, even if I gave it the most basic configurations. </div><div><br /></div><div>The problem was that the server was using an older version of PowerShell that would not support the MicrosoftTeams library. The solution was to upgrade it to PowerShell 7</div><div><a href="https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2#msi" target="_blank">https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2#msi</a><br /><div>After upgrading, I was able to run the script and create a Team with no issues.</div><div><br /></div></div><div>Sources:</div><div><ul style="text-align: left;"><li><a href="https://techgenix.com/creating-a-new-team-using-powershell/" target="_blank">https://techgenix.com/creating-a-new-team-using-powershell/</a><br /></li><li><a href="https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-managing-teams" target="_blank">https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-managing-teams</a><br /></li><li><a href="https://docs.microsoft.com/en-us/powershell/module/teams/new-team?view=teams-ps" target="_blank">https://docs.microsoft.com/en-us/powershell/module/teams/new-team?view=teams-ps</a><br /></li><li><a href="https://answers.microsoft.com/en-us/msoffice/forum/all/turning-off-email-notification-when-adding-team/ea22f6c7-20f0-4b35-97eb-bf923b353e4f">https://answers.microsoft.com/en-us/msoffice/forum/all/turning-off-email-notification-when-adding-team/ea22f6c7-20f0-4b35-97eb-bf923b353e4f</a><br /></li><li><a href="https://docs.microsoft.com/en-us/microsoft-365/solutions/manage-creation-of-groups?view=o365-worldwide" target="_blank">https://docs.microsoft.com/en-us/microsoft-365/solutions/manage-creation-of-groups?view=o365-worldwide</a><br /></li><li><a href="https://regroove.ca/stellark/2021/09/15/teams-governance-and-locking-down-teams-creation/" target="_blank">https://regroove.ca/stellark/2021/09/15/teams-governance-and-locking-down-teams-creation/</a></li><li><a href="https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2#msi">https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2#msi</a><br /></li></ul></div></div><br /> <p></p>Tom DeMeulenaerehttp://www.blogger.com/profile/16010060105861251424noreply@blogger.com0