<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intune Archives - SuperUserTips</title>
	<atom:link href="https://superusertips.com/category/intune/feed/" rel="self" type="application/rss+xml" />
	<link>https://superusertips.com/category/intune/</link>
	<description>an endpoint admin&#039;s journal</description>
	<lastBuildDate>Wed, 03 Jul 2024 22:03:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://superusertips.com/wp-content/uploads/2023/10/cropped-Favicon_2023_512x512-150x150.jpg</url>
	<title>Intune Archives - SuperUserTips</title>
	<link>https://superusertips.com/category/intune/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Deploy Trusted sites zone assignment using Intune</title>
		<link>https://superusertips.com/2023/11/deploy-trusted-sites-intune-configuration-profiles/</link>
					<comments>https://superusertips.com/2023/11/deploy-trusted-sites-intune-configuration-profiles/#comments</comments>
		
		<dc:creator><![CDATA[mando]]></dc:creator>
		<pubDate>Mon, 06 Nov 2023 08:04:36 +0000</pubDate>
				<category><![CDATA[Intune]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">https://superusertips.com/?p=327</guid>

					<description><![CDATA[<p>Deploy a set of trusted sites overriding users&#8217; ability to add trusted sites themselves. To acheive this, an Intune configuration profile Trusted site zone assignment can be deployed to devices/users&#46;&#46;&#46;</p>
<p>The post <a href="https://superusertips.com/2023/11/deploy-trusted-sites-intune-configuration-profiles/">Deploy Trusted sites zone assignment using Intune</a> appeared first on <a href="https://superusertips.com">SuperUserTips</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Deploy a set of trusted sites overriding users&#8217; ability to add trusted sites themselves. To acheive this, an Intune configuration profile Trusted site zone assignment can be deployed to devices/users group as required.</p>



<span id="more-327"></span>



<p>Login to Intune Portal and navigate to: <strong>Devices</strong> &gt; <strong>Windows</strong> &gt; <strong>Configuration Profiles</strong>.</p>



<p>Hit the <strong>Create</strong> button and Select <strong>New policy</strong></p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="414" src="https://superusertips.com/wp-content/uploads/2023/11/image-1024x414.png" alt="" class="wp-image-335" srcset="https://superusertips.com/wp-content/uploads/2023/11/image-1024x414.png 1024w, https://superusertips.com/wp-content/uploads/2023/11/image-300x121.png 300w, https://superusertips.com/wp-content/uploads/2023/11/image-768x310.png 768w, https://superusertips.com/wp-content/uploads/2023/11/image-920x372.png 920w, https://superusertips.com/wp-content/uploads/2023/11/image.png 1228w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>From the <em>Create a profile</em> menu, select<strong> Windows 10 and later</strong> for Platform , <strong>Templates</strong> for Profile type. Select <strong>Administrative templates</strong> and click <strong>Create</strong>.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="500" height="880" src="https://superusertips.com/wp-content/uploads/2023/11/image-1.png" alt="" class="wp-image-340" style="aspect-ratio:0.5681818181818182;width:320px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/11/image-1.png 500w, https://superusertips.com/wp-content/uploads/2023/11/image-1-170x300.png 170w" sizes="(max-width: 500px) 100vw, 500px" /></figure>



<p>Give the profile desired name and click <strong>Next</strong>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="800" height="250" src="https://superusertips.com/wp-content/uploads/2023/11/image-3.png" alt="" class="wp-image-343" srcset="https://superusertips.com/wp-content/uploads/2023/11/image-3.png 800w, https://superusertips.com/wp-content/uploads/2023/11/image-3-300x94.png 300w, https://superusertips.com/wp-content/uploads/2023/11/image-3-768x240.png 768w" sizes="(max-width: 800px) 100vw, 800px" /></figure>



<p>In Configurations settings, select <strong>Computer Configuration</strong> and search for keyword &#8220;<strong><em>Site to Zone</em></strong>&#8220;, <strong>Site to Zone Assignment List</strong> setting will be listed under search results. Go ahead click on it to <strong>Select</strong> it.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="899" height="244" src="https://superusertips.com/wp-content/uploads/2023/11/image-4.png" alt="" class="wp-image-344" srcset="https://superusertips.com/wp-content/uploads/2023/11/image-4.png 899w, https://superusertips.com/wp-content/uploads/2023/11/image-4-300x81.png 300w, https://superusertips.com/wp-content/uploads/2023/11/image-4-768x208.png 768w" sizes="auto, (max-width: 899px) 100vw, 899px" /></figure>



<p>Once selected, a Site to Zone Assignment List page will appear on right side explaining different zones and values required for these zone for setup. Since this profile is being used for trusted sites, we will use the Value <strong>&#8220;2&#8221;</strong> . Go ahead and select <strong>Enabled</strong> button and start entering the trusted sites as required. please ensure to set each value to <strong>&#8220;2&#8221;</strong>. See example below:</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="750" height="454" src="https://superusertips.com/wp-content/uploads/2023/11/image-6.png" alt="" class="wp-image-346" style="aspect-ratio:1.6519823788546255;width:505px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/11/image-6.png 750w, https://superusertips.com/wp-content/uploads/2023/11/image-6-300x182.png 300w" sizes="auto, (max-width: 750px) 100vw, 750px" /><figcaption class="wp-element-caption"><sup>Learn more about Zones: <a href="https://learn.microsoft.com/en-us/troubleshoot/developer/browsers/security-privacy/ie-security-zones-registry-entries#zones">https://learn.microsoft.com/en-us/troubleshoot/developer/browsers/security-privacy/ie-security-zones-registry-entries#zones</a> </sup></figcaption></figure>



<p>Once done adding the list of sites, click <strong>OK</strong>  to close it and Hit Next on Configuration settings page.</p>



<p>Add Scope tags if needed. </p>



<p>Under <strong>Assignments</strong>, Click <strong>Add groups</strong> to target the policy deployment to specific group of devices/users. You can also select <strong>Add all users</strong> / <strong>All all devices</strong>.</p>



<p> Hit <strong>Next</strong>. Then Hit <strong>Review + Save</strong> button to save. </p>
<p>The post <a href="https://superusertips.com/2023/11/deploy-trusted-sites-intune-configuration-profiles/">Deploy Trusted sites zone assignment using Intune</a> appeared first on <a href="https://superusertips.com">SuperUserTips</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://superusertips.com/2023/11/deploy-trusted-sites-intune-configuration-profiles/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Uninstall Teams chat app using remediation script and a configuration profile in Intune</title>
		<link>https://superusertips.com/2023/10/uninstall-teams-chat-app-using-remediation-script-and-a-configuration-profile-in-intune/</link>
					<comments>https://superusertips.com/2023/10/uninstall-teams-chat-app-using-remediation-script-and-a-configuration-profile-in-intune/#respond</comments>
		
		<dc:creator><![CDATA[mando]]></dc:creator>
		<pubDate>Tue, 31 Oct 2023 05:03:59 +0000</pubDate>
				<category><![CDATA[Intune]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">https://superusertips.com/?p=258</guid>

					<description><![CDATA[<p>Windows 11 OS upgrades and new Windows 11 workstations are coming with a built-in Teams for home chat app preinstalled, intented to use with a personal Microsoft account . This&#46;&#46;&#46;</p>
<p>The post <a href="https://superusertips.com/2023/10/uninstall-teams-chat-app-using-remediation-script-and-a-configuration-profile-in-intune/">Uninstall Teams chat app using remediation script and a configuration profile in Intune</a> appeared first on <a href="https://superusertips.com">SuperUserTips</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Windows 11 OS upgrades and new Windows 11 workstations are coming with a built-in Teams for home chat app preinstalled, intented to use with a personal Microsoft account . This can be an issue for orgs that use Teams for work or school edition as the preinstalled chat version of app remains installed even after installing Teams for work or shool, causing confusion between which one to use. Users may attempt to sign in to chat app with their work account which wont work. </p>



<p>Use the methods below on how to uninstall and disable the built-in chat app using Intune.</p>



<span id="more-258"></span>



<h3 class="wp-block-heading">Step 1: Use a Proactive Remediation script</h3>



<p>Proactive remediation script package will detect uninstall the Teams chat app if it exists and also configure the registry to disable auto-install of chat app in future.</p>



<p>For this, you&#8217;ll need to create two powershell script files, one for detecting the issue and another for remediation:</p>



<ol class="wp-block-list">
<li>Detect_TeamsChatApp.ps1</li>



<li>Remediate_TeamsChatApp.ps1</li>
</ol>



<p>You can download both files in zip format here:<br><a href="https://superusertips.com/wp-content/uploads/2023/10/TeamsChatApp_ProactiveRemediation_Files.zip"><strong>TeamsChatApp_ProactiveRemediation_Files.zip</strong></a></p>



<p>OR</p>



<p>Copy paste contents of each file below to create your own files</p>



<p><code>Detect_TeamsChatApp.ps1</code></p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2d333d;color:#9eadbd">PowerShell</span><span role="button" tabindex="0" data-code="$OSversion = (Get-WmiObject -class Win32_OperatingSystem).Buildnumber
If ($OSversion -like &quot;2*&quot;) {
    try {

        # check the reg key for teams chat app autoinstall
        If (((Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications').PSObject.Properties.Name -contains 'ConfigureChatAutoInstall') -eq $true) {
            if ( (Get-ItemPropertyValue -LiteralPath 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications' -Name 'ConfigureChatAutoInstall' -ErrorAction Stop ) -eq 0 ) {
                $RegCompliance = $true 
            }
            else { 
                $RegCompliance = $false 
            } 
        }
        else { $RegCompliance = $true }

        # check if the teams app is installed
        if ($null -eq (Get-AppxPackage -Name MicrosoftTeams) ) { $AppCompliance = $true }
        else { $AppCompliance = $false }
    
        # evaluate the compliance
        if ($RegCompliance -and $AppCompliance -eq $true) {

            Write-Host &quot;Success, app/reg in Compliance&quot;
            exit 0
        }
        else {
            Write-Host &quot;Failure, app/reg detected&quot;
            exit 1
        }
   
    
    }
    catch {
        $errMsg = $_.Exception.Message
        Write-Host $errMsg
        exit 1
    }
}
else {
    Write-Output &quot;OS is not windows 11. Exiting&quot;
    Exit 0
}" style="color:#adbac7;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki github-dark-dimmed" style="background-color: #22272e" tabindex="0"><code><span class="line"><span style="color: #ADBAC7">$OSversion </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> (</span><span style="color: #6CB6FF">Get-WmiObject</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">class Win32_OperatingSystem).Buildnumber</span></span>
<span class="line"><span style="color: #F47067">If</span><span style="color: #ADBAC7"> ($OSversion </span><span style="color: #F47067">-like</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;2*&quot;</span><span style="color: #ADBAC7">) {</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">try</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390"># check the reg key for teams chat app autoinstall</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">If</span><span style="color: #ADBAC7"> (((</span><span style="color: #6CB6FF">Get-ItemProperty</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Path </span><span style="color: #96D0FF">&#39;HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications&#39;</span><span style="color: #ADBAC7">).PSObject.Properties.Name </span><span style="color: #F47067">-contains</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&#39;ConfigureChatAutoInstall&#39;</span><span style="color: #ADBAC7">) </span><span style="color: #F47067">-eq</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$true</span><span style="color: #ADBAC7">) {</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #F47067">if</span><span style="color: #ADBAC7"> ( (</span><span style="color: #6CB6FF">Get-ItemPropertyValue</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">LiteralPath </span><span style="color: #96D0FF">&#39;HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications&#39;</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Name </span><span style="color: #96D0FF">&#39;ConfigureChatAutoInstall&#39;</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">ErrorAction Stop ) </span><span style="color: #F47067">-eq</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">0</span><span style="color: #ADBAC7"> ) {</span></span>
<span class="line"><span style="color: #ADBAC7">                $RegCompliance </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$true</span><span style="color: #ADBAC7"> </span></span>
<span class="line"><span style="color: #ADBAC7">            }</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #F47067">else</span><span style="color: #ADBAC7"> { </span></span>
<span class="line"><span style="color: #ADBAC7">                $RegCompliance </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$false</span><span style="color: #ADBAC7"> </span></span>
<span class="line"><span style="color: #ADBAC7">            } </span></span>
<span class="line"><span style="color: #ADBAC7">        }</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">else</span><span style="color: #ADBAC7"> { $RegCompliance </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$true</span><span style="color: #ADBAC7"> }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390"># check if the teams app is installed</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">if</span><span style="color: #ADBAC7"> (</span><span style="color: #6CB6FF">$null</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-eq</span><span style="color: #ADBAC7"> (</span><span style="color: #6CB6FF">Get-AppxPackage</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Name MicrosoftTeams) ) { $AppCompliance </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$true</span><span style="color: #ADBAC7"> }</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">else</span><span style="color: #ADBAC7"> { $AppCompliance </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$false</span><span style="color: #ADBAC7"> }</span></span>
<span class="line"><span style="color: #ADBAC7">    </span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390"># evaluate the compliance</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">if</span><span style="color: #ADBAC7"> ($RegCompliance </span><span style="color: #F47067">-and</span><span style="color: #ADBAC7"> $AppCompliance </span><span style="color: #F47067">-eq</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$true</span><span style="color: #ADBAC7">) {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #6CB6FF">Write-Host</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;Success, app/reg in Compliance&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #F47067">exit</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">0</span></span>
<span class="line"><span style="color: #ADBAC7">        }</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">else</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #6CB6FF">Write-Host</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;Failure, app/reg detected&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #F47067">exit</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">1</span></span>
<span class="line"><span style="color: #ADBAC7">        }</span></span>
<span class="line"><span style="color: #ADBAC7">   </span></span>
<span class="line"><span style="color: #ADBAC7">    </span></span>
<span class="line"><span style="color: #ADBAC7">    }</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">catch</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">        $errMsg </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$_</span><span style="color: #ADBAC7">.Exception.Message</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #6CB6FF">Write-Host</span><span style="color: #ADBAC7"> $errMsg</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #F47067">exit</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">1</span></span>
<span class="line"><span style="color: #ADBAC7">    }</span></span>
<span class="line"><span style="color: #ADBAC7">}</span></span>
<span class="line"><span style="color: #F47067">else</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #6CB6FF">Write-Output</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;OS is not windows 11. Exiting&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">Exit</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">0</span></span>
<span class="line"><span style="color: #ADBAC7">}</span></span></code></pre></div>



<p></p>



<p><code>Remediate_TeamsChatApp.ps1</code></p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-width:calc(3 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2d333d;color:#9eadbd">PowerShell</span><span role="button" tabindex="0" data-code="# Give &quot;Administrators&quot; group full ownership of HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications.
function enable-privilege {
    param(
        ## The privilege to adjust. This set is taken from
        ## http://msdn.microsoft.com/en-us/library/bb530716(VS.85).aspx
        [ValidateSet(
            &quot;SeAssignPrimaryTokenPrivilege&quot;, &quot;SeAuditPrivilege&quot;, &quot;SeBackupPrivilege&quot;,
            &quot;SeChangeNotifyPrivilege&quot;, &quot;SeCreateGlobalPrivilege&quot;, &quot;SeCreatePagefilePrivilege&quot;,
            &quot;SeCreatePermanentPrivilege&quot;, &quot;SeCreateSymbolicLinkPrivilege&quot;, &quot;SeCreateTokenPrivilege&quot;,
            &quot;SeDebugPrivilege&quot;, &quot;SeEnableDelegationPrivilege&quot;, &quot;SeImpersonatePrivilege&quot;, &quot;SeIncreaseBasePriorityPrivilege&quot;,
            &quot;SeIncreaseQuotaPrivilege&quot;, &quot;SeIncreaseWorkingSetPrivilege&quot;, &quot;SeLoadDriverPrivilege&quot;,
            &quot;SeLockMemoryPrivilege&quot;, &quot;SeMachineAccountPrivilege&quot;, &quot;SeManageVolumePrivilege&quot;,
            &quot;SeProfileSingleProcessPrivilege&quot;, &quot;SeRelabelPrivilege&quot;, &quot;SeRemoteShutdownPrivilege&quot;,
            &quot;SeRestorePrivilege&quot;, &quot;SeSecurityPrivilege&quot;, &quot;SeShutdownPrivilege&quot;, &quot;SeSyncAgentPrivilege&quot;,
            &quot;SeSystemEnvironmentPrivilege&quot;, &quot;SeSystemProfilePrivilege&quot;, &quot;SeSystemtimePrivilege&quot;,
            &quot;SeTakeOwnershipPrivilege&quot;, &quot;SeTcbPrivilege&quot;, &quot;SeTimeZonePrivilege&quot;, &quot;SeTrustedCredManAccessPrivilege&quot;,
            &quot;SeUndockPrivilege&quot;, &quot;SeUnsolicitedInputPrivilege&quot;)]
        $Privilege,
        ## The process on which to adjust the privilege. Defaults to the current process.
        $ProcessId = $pid,
        ## Switch to disable the privilege, rather than enable it.
        [Switch] $Disable
    )

    ## Taken from P/Invoke.NET with minor adjustments.
    $definition = @'
 using System;
 using System.Runtime.InteropServices;
  
 public class AdjPriv
 {
  [DllImport(&quot;advapi32.dll&quot;, ExactSpelling = true, SetLastError = true)]
  internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
   ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
  
  [DllImport(&quot;advapi32.dll&quot;, ExactSpelling = true, SetLastError = true)]
  internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
  [DllImport(&quot;advapi32.dll&quot;, SetLastError = true)]
  internal static extern bool LookupPrivilegeValue(string host, string name, ref long pluid);
  [StructLayout(LayoutKind.Sequential, Pack = 1)]
  internal struct TokPriv1Luid
  {
   public int Count;
   public long Luid;
   public int Attr;
  }
  
  internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
  internal const int SE_PRIVILEGE_DISABLED = 0x00000000;
  internal const int TOKEN_QUERY = 0x00000008;
  internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
  public static bool EnablePrivilege(long processHandle, string privilege, bool disable)
  {
   bool retVal;
   TokPriv1Luid tp;
   IntPtr hproc = new IntPtr(processHandle);
   IntPtr htok = IntPtr.Zero;
   retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
   tp.Count = 1;
   tp.Luid = 0;
   if(disable)
   {
    tp.Attr = SE_PRIVILEGE_DISABLED;
   }
   else
   {
    tp.Attr = SE_PRIVILEGE_ENABLED;
   }
   retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
   retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
   return retVal;
  }
 }
'@

    $processHandle = (Get-Process -id $ProcessId).Handle
    $type = Add-Type $definition -PassThru
    $type[0]::EnablePrivilege($processHandle, $Privilege, $Disable)
}

enable-privilege SeTakeOwnershipPrivilege 
$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey(&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Communications&quot;, [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree, [System.Security.AccessControl.RegistryRights]::takeownership)
# You must get a blank acl for the key b/c you do not currently have access
$acl = $key.GetAccessControl([System.Security.AccessControl.AccessControlSections]::None)
$me = [System.Security.Principal.NTAccount]&quot;Administrators&quot;
$acl.SetOwner($me)
$key.SetAccessControl($acl)

# After you have set owner you need to get the acl with the perms so you can modify it.
$acl = $key.GetAccessControl()
$rule = New-Object System.Security.AccessControl.RegistryAccessRule (&quot;Administrators&quot;, &quot;FullControl&quot;, &quot;Allow&quot;)
$acl.SetAccessRule($rule)
$key.SetAccessControl($acl)

$key.Close()

# Remediation
try {
    #Disable Auto Install registry for Teams chat app
    if (((Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications').PSObject.Properties.Name -contains 'ConfigureChatAutoInstall') -eq $true) {
        Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications' -Name 'ConfigureChatAutoInstall' -Value 0 -Type &quot;Dword&quot;
    }
    else {
        Write-Output &quot;Registry value ConfigureChatAutoInstall not found&quot;
    }

    # uninstall the teams consumer app
    Get-AppxPackage -Name MicrosoftTeams | Remove-AppxPackage -ErrorAction stop

    # as nothing errored out, we will report success
    Write-Output &quot;Success, regkey set and app uninstalled&quot;
    exit 0
}

catch {
    $errMsg = $_.Exception.Message
    Write-Host $errMsg
    exit 1
}" style="color:#adbac7;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki github-dark-dimmed" style="background-color: #22272e" tabindex="0"><code><span class="line"><span style="color: #768390"># Give &quot;Administrators&quot; group full ownership of HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications.</span></span>
<span class="line"><span style="color: #F47067">function</span><span style="color: #ADBAC7"> </span><span style="color: #DCBDFB">enable-privilege</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">param</span><span style="color: #ADBAC7">(</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390">## The privilege to adjust. This set is taken from</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390">## http://msdn.microsoft.com/en-us/library/bb530716(VS.85).aspx</span></span>
<span class="line"><span style="color: #ADBAC7">        [</span><span style="color: #6CB6FF">ValidateSet</span><span style="color: #ADBAC7">(</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeAssignPrimaryTokenPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeAuditPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeBackupPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeChangeNotifyPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeCreateGlobalPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeCreatePagefilePrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeCreatePermanentPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeCreateSymbolicLinkPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeCreateTokenPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeDebugPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeEnableDelegationPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeImpersonatePrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeIncreaseBasePriorityPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeIncreaseQuotaPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeIncreaseWorkingSetPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeLoadDriverPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeLockMemoryPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeMachineAccountPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeManageVolumePrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeProfileSingleProcessPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeRelabelPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeRemoteShutdownPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeRestorePrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeSecurityPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeShutdownPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeSyncAgentPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeSystemEnvironmentPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeSystemProfilePrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeSystemtimePrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeTakeOwnershipPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeTcbPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeTimeZonePrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeTrustedCredManAccessPrivilege&quot;</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">            </span><span style="color: #96D0FF">&quot;SeUndockPrivilege&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;SeUnsolicitedInputPrivilege&quot;</span><span style="color: #ADBAC7">)]</span></span>
<span class="line"><span style="color: #ADBAC7">        $Privilege</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390">## The process on which to adjust the privilege. Defaults to the current process.</span></span>
<span class="line"><span style="color: #ADBAC7">        $ProcessId </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$pid</span><span style="color: #F47067">,</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #768390">## Switch to disable the privilege, rather than enable it.</span></span>
<span class="line"><span style="color: #ADBAC7">        [</span><span style="color: #F47067">Switch</span><span style="color: #ADBAC7">] $Disable</span></span>
<span class="line"><span style="color: #ADBAC7">    )</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #768390">## Taken from P/Invoke.NET with minor adjustments.</span></span>
<span class="line"><span style="color: #ADBAC7">    $definition </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">@&#39;</span></span>
<span class="line"><span style="color: #96D0FF"> using System;</span></span>
<span class="line"><span style="color: #96D0FF"> using System.Runtime.InteropServices;</span></span>
<span class="line"><span style="color: #96D0FF">  </span></span>
<span class="line"><span style="color: #96D0FF"> public class AdjPriv</span></span>
<span class="line"><span style="color: #96D0FF"> {</span></span>
<span class="line"><span style="color: #96D0FF">  [DllImport(&quot;advapi32.dll&quot;, ExactSpelling = true, SetLastError = true)]</span></span>
<span class="line"><span style="color: #96D0FF">  internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,</span></span>
<span class="line"><span style="color: #96D0FF">   ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);</span></span>
<span class="line"><span style="color: #96D0FF">  </span></span>
<span class="line"><span style="color: #96D0FF">  [DllImport(&quot;advapi32.dll&quot;, ExactSpelling = true, SetLastError = true)]</span></span>
<span class="line"><span style="color: #96D0FF">  internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);</span></span>
<span class="line"><span style="color: #96D0FF">  [DllImport(&quot;advapi32.dll&quot;, SetLastError = true)]</span></span>
<span class="line"><span style="color: #96D0FF">  internal static extern bool LookupPrivilegeValue(string host, string name, ref long pluid);</span></span>
<span class="line"><span style="color: #96D0FF">  [StructLayout(LayoutKind.Sequential, Pack = 1)]</span></span>
<span class="line"><span style="color: #96D0FF">  internal struct TokPriv1Luid</span></span>
<span class="line"><span style="color: #96D0FF">  {</span></span>
<span class="line"><span style="color: #96D0FF">   public int Count;</span></span>
<span class="line"><span style="color: #96D0FF">   public long Luid;</span></span>
<span class="line"><span style="color: #96D0FF">   public int Attr;</span></span>
<span class="line"><span style="color: #96D0FF">  }</span></span>
<span class="line"><span style="color: #96D0FF">  </span></span>
<span class="line"><span style="color: #96D0FF">  internal const int SE_PRIVILEGE_ENABLED = 0x00000002;</span></span>
<span class="line"><span style="color: #96D0FF">  internal const int SE_PRIVILEGE_DISABLED = 0x00000000;</span></span>
<span class="line"><span style="color: #96D0FF">  internal const int TOKEN_QUERY = 0x00000008;</span></span>
<span class="line"><span style="color: #96D0FF">  internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;</span></span>
<span class="line"><span style="color: #96D0FF">  public static bool EnablePrivilege(long processHandle, string privilege, bool disable)</span></span>
<span class="line"><span style="color: #96D0FF">  {</span></span>
<span class="line"><span style="color: #96D0FF">   bool retVal;</span></span>
<span class="line"><span style="color: #96D0FF">   TokPriv1Luid tp;</span></span>
<span class="line"><span style="color: #96D0FF">   IntPtr hproc = new IntPtr(processHandle);</span></span>
<span class="line"><span style="color: #96D0FF">   IntPtr htok = IntPtr.Zero;</span></span>
<span class="line"><span style="color: #96D0FF">   retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);</span></span>
<span class="line"><span style="color: #96D0FF">   tp.Count = 1;</span></span>
<span class="line"><span style="color: #96D0FF">   tp.Luid = 0;</span></span>
<span class="line"><span style="color: #96D0FF">   if(disable)</span></span>
<span class="line"><span style="color: #96D0FF">   {</span></span>
<span class="line"><span style="color: #96D0FF">    tp.Attr = SE_PRIVILEGE_DISABLED;</span></span>
<span class="line"><span style="color: #96D0FF">   }</span></span>
<span class="line"><span style="color: #96D0FF">   else</span></span>
<span class="line"><span style="color: #96D0FF">   {</span></span>
<span class="line"><span style="color: #96D0FF">    tp.Attr = SE_PRIVILEGE_ENABLED;</span></span>
<span class="line"><span style="color: #96D0FF">   }</span></span>
<span class="line"><span style="color: #96D0FF">   retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);</span></span>
<span class="line"><span style="color: #96D0FF">   retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);</span></span>
<span class="line"><span style="color: #96D0FF">   return retVal;</span></span>
<span class="line"><span style="color: #96D0FF">  }</span></span>
<span class="line"><span style="color: #96D0FF"> }</span></span>
<span class="line"><span style="color: #96D0FF">&#39;@</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">    $processHandle </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> (</span><span style="color: #6CB6FF">Get-Process</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">id $ProcessId).Handle</span></span>
<span class="line"><span style="color: #ADBAC7">    $type </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">Add-Type</span><span style="color: #ADBAC7"> $definition </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">PassThru</span></span>
<span class="line"><span style="color: #ADBAC7">    $type[</span><span style="color: #6CB6FF">0</span><span style="color: #ADBAC7">]::EnablePrivilege($processHandle</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> $Privilege</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> $Disable)</span></span>
<span class="line"><span style="color: #ADBAC7">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6CB6FF">enable-privilege</span><span style="color: #ADBAC7"> SeTakeOwnershipPrivilege </span></span>
<span class="line"><span style="color: #ADBAC7">$key </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> [</span><span style="color: #F47067">Microsoft.Win32.Registry</span><span style="color: #ADBAC7">]::LocalMachine.OpenSubKey(</span><span style="color: #96D0FF">&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Communications&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> [</span><span style="color: #F47067">Microsoft.Win32.RegistryKeyPermissionCheck</span><span style="color: #ADBAC7">]::ReadWriteSubTree</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> [</span><span style="color: #F47067">System.Security.AccessControl.RegistryRights</span><span style="color: #ADBAC7">]::takeownership)</span></span>
<span class="line"><span style="color: #768390"># You must get a blank acl for the key b/c you do not currently have access</span></span>
<span class="line"><span style="color: #ADBAC7">$acl </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> $key.GetAccessControl([</span><span style="color: #F47067">System.Security.AccessControl.AccessControlSections</span><span style="color: #ADBAC7">]::None)</span></span>
<span class="line"><span style="color: #ADBAC7">$me </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> [</span><span style="color: #F47067">System.Security.Principal.NTAccount</span><span style="color: #ADBAC7">]</span><span style="color: #96D0FF">&quot;Administrators&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">$acl.SetOwner($me)</span></span>
<span class="line"><span style="color: #ADBAC7">$key.SetAccessControl($acl)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #768390"># After you have set owner you need to get the acl with the perms so you can modify it.</span></span>
<span class="line"><span style="color: #ADBAC7">$acl </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> $key.GetAccessControl()</span></span>
<span class="line"><span style="color: #ADBAC7">$rule </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">New-Object</span><span style="color: #ADBAC7"> System.Security.AccessControl.RegistryAccessRule (</span><span style="color: #96D0FF">&quot;Administrators&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;FullControl&quot;</span><span style="color: #F47067">,</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;Allow&quot;</span><span style="color: #ADBAC7">)</span></span>
<span class="line"><span style="color: #ADBAC7">$acl.SetAccessRule($rule)</span></span>
<span class="line"><span style="color: #ADBAC7">$key.SetAccessControl($acl)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">$key.Close()</span></span>
<span class="line"></span>
<span class="line"><span style="color: #768390"># Remediation</span></span>
<span class="line"><span style="color: #F47067">try</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #768390">#Disable Auto Install registry for Teams chat app</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">if</span><span style="color: #ADBAC7"> (((</span><span style="color: #6CB6FF">Get-ItemProperty</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Path </span><span style="color: #96D0FF">&#39;HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications&#39;</span><span style="color: #ADBAC7">).PSObject.Properties.Name </span><span style="color: #F47067">-contains</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&#39;ConfigureChatAutoInstall&#39;</span><span style="color: #ADBAC7">) </span><span style="color: #F47067">-eq</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$true</span><span style="color: #ADBAC7">) {</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #6CB6FF">Set-ItemProperty</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Path </span><span style="color: #96D0FF">&#39;HKLM:\Software\Microsoft\Windows\CurrentVersion\Communications&#39;</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Name </span><span style="color: #96D0FF">&#39;ConfigureChatAutoInstall&#39;</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Value </span><span style="color: #6CB6FF">0</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Type </span><span style="color: #96D0FF">&quot;Dword&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">    }</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">else</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">        </span><span style="color: #6CB6FF">Write-Output</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;Registry value ConfigureChatAutoInstall not found&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #768390"># uninstall the teams consumer app</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #6CB6FF">Get-AppxPackage</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">Name MicrosoftTeams </span><span style="color: #F47067">|</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">Remove-AppxPackage</span><span style="color: #ADBAC7"> </span><span style="color: #F47067">-</span><span style="color: #ADBAC7">ErrorAction stop</span></span>
<span class="line"></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #768390"># as nothing errored out, we will report success</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #6CB6FF">Write-Output</span><span style="color: #ADBAC7"> </span><span style="color: #96D0FF">&quot;Success, regkey set and app uninstalled&quot;</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">exit</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">0</span></span>
<span class="line"><span style="color: #ADBAC7">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F47067">catch</span><span style="color: #ADBAC7"> {</span></span>
<span class="line"><span style="color: #ADBAC7">    $errMsg </span><span style="color: #F47067">=</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">$_</span><span style="color: #ADBAC7">.Exception.Message</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #6CB6FF">Write-Host</span><span style="color: #ADBAC7"> $errMsg</span></span>
<span class="line"><span style="color: #ADBAC7">    </span><span style="color: #F47067">exit</span><span style="color: #ADBAC7"> </span><span style="color: #6CB6FF">1</span></span>
<span class="line"><span style="color: #ADBAC7">}</span></span></code></pre></div>



<p></p>



<p>Once you have both a detection and a remediation script file:<br>Launch <strong>Intune</strong> portal and navigate to <strong>Devices</strong> &gt; <strong>Remediations</strong> &gt; <strong>Create script package</strong></p>



<p> <img loading="lazy" decoding="async" width="800" height="238" class="wp-image-275" style="width: 800px;" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_1.jpg" alt="" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_1.jpg 800w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_1-300x89.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_1-768x228.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>



<p></p>



<p>Type in a <strong>Name</strong> for your script and hit <strong>Next</strong> button</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1000" height="473" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_2.jpg" alt="" class="wp-image-277" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_2.jpg 1000w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_2-300x142.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_2-768x363.jpg 768w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_2-920x435.jpg 920w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></figure>



<p></p>



<p>On the <strong>Settings</strong> page, <strong>upload</strong> the Detection and the Remediation scripts created in earlier steps and hit <strong>Next</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1000" height="813" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_3.jpg" alt="" class="wp-image-285" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_3.jpg 1000w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_3-300x244.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_3-768x624.jpg 768w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_3-920x748.jpg 920w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></figure>



<p>In the next step, Select any<strong> Scope tags </strong>as needed and Hit Next</p>



<p>Under <strong>Assignments</strong>, select your <strong>Device</strong> or <strong>User groups</strong> you would like to apply this remediation scripts and also select your preferred <strong>Schedule</strong> and <strong>interval time</strong>.<em> I recommend running this with daily schedule repeating everyday once every morning.</em></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="900" height="767" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_4.jpg" alt="" class="wp-image-288" style="aspect-ratio:1.1734028683181226;width:644px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_4.jpg 900w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_4-300x256.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_4-768x655.jpg 768w" sizes="auto, (max-width: 900px) 100vw, 900px" /></figure>



<p>Finally, under <strong>Review + create</strong> hit <strong>Create </strong>button after reviewing all settings.</p>



<p>After the proactive remediation implemenation you can always head to <strong>Devices</strong> &gt; <strong>Remediations</strong> and click on the <strong>script package name</strong> you created to check the device status report</p>



<h3 class="wp-block-heading">Step 2: Hide the chat icon from taskbar</h3>



<p>The above proactive remediation script will uninstall the app but users may still see the Teams chat app icon in the taskbar which upon click can reinstall itself. Create a configuration profile in Intune to disable the Teams Chat app icon from taskbar as shown below:</p>



<p>Navigate to <strong>Devices</strong> &gt; <strong>Windows</strong> &gt; <strong>Configuration profiles</strong> and Hit <strong>Create profile</strong> button </p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="800" height="374" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_5.jpg" alt="" class="wp-image-290" style="aspect-ratio:2.1390374331550803;width:637px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_5.jpg 800w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_5-300x140.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_5-768x359.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p>Select <strong>Windows 10 or later</strong> for Platform and<strong> Setting Catalog</strong> for Profile type in next step and hit <strong>Create </strong>button</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="600" height="244" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_6.jpg" alt="" class="wp-image-292" style="aspect-ratio:2.459016393442623;width:451px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_6.jpg 600w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_6-300x122.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></figure>



<p>Next, give your profile a name and hit <strong>Next</strong> button</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="800" height="295" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_7.jpg" alt="" class="wp-image-293" style="aspect-ratio:2.711864406779661;width:598px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_7.jpg 800w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_7-300x111.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_7-768x283.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p>On <strong>Configuration settings</strong> page, click <strong>Add settings</strong> and search for <strong>&#8220;Configure Chat&#8221;</strong> in the settings picker search box on the right and press <strong>Enter</strong>. You will see category <strong>&#8220;Experience&#8221;</strong> loaded under the search. Click on <strong>Experience</strong> category and <strong>check</strong> the box next to <strong>Configure Chat Icon</strong> setting. </p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="800" height="360" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_8.jpg" alt="" class="wp-image-294" style="aspect-ratio:2.2222222222222223;width:430px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_8.jpg 800w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_8-300x135.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_8-768x346.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="800" height="703" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_9.jpg" alt="" class="wp-image-295" style="aspect-ratio:1.1379800853485065;width:650px;height:auto" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_9.jpg 800w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_9-300x264.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_9-768x675.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p>This will add the <strong>Configure Chat Icon</strong> setting to your <strong>Configuration settings</strong>. Select <strong>Disabled</strong> from the drop down menu next to <strong>Configure Chat Icon</strong> setting as shown below and Hit <strong>Next</strong>.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="800" height="398" src="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_901.jpg" alt="" class="wp-image-296" srcset="https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_901.jpg 800w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_901-300x149.jpg 300w, https://superusertips.com/wp-content/uploads/2023/10/Uninstall-Teams-chat-app_901-768x382.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p class="has-small-font-size"><em>You can also set it to Hide but this will allow users to show or hide in local taskbar settings</em>. <em><a href="https://learn.microsoft.com/en-us/windows/client-management/mdm/policy-csp-Experience?WT.mc_id=Portal-fx#configurechaticon">Read more</a></em></p>



<p>Apply <strong>Scope tags</strong> and required and hit <strong>Next</strong>.</p>



<p>Under<strong> Assignments</strong>, add your desired <strong>device</strong> or <strong>user groups</strong> to apply this policy to and Hit <strong>Next</strong>.</p>



<p>At last, hit the <strong>Create</strong> button to finish creating and applying this Configuration profile.</p>



<p></p>



<p>Congratulations, you have now created a proactive remediation and a configuration profile to disable and block Teams home Chat app from installing </p>
<p>The post <a href="https://superusertips.com/2023/10/uninstall-teams-chat-app-using-remediation-script-and-a-configuration-profile-in-intune/">Uninstall Teams chat app using remediation script and a configuration profile in Intune</a> appeared first on <a href="https://superusertips.com">SuperUserTips</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://superusertips.com/2023/10/uninstall-teams-chat-app-using-remediation-script-and-a-configuration-profile-in-intune/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Intune Last Check-in date not updating for Windows device</title>
		<link>https://superusertips.com/2023/10/intune-last-check-in-date-not-updating-for-windows-device/</link>
					<comments>https://superusertips.com/2023/10/intune-last-check-in-date-not-updating-for-windows-device/#respond</comments>
		
		<dc:creator><![CDATA[mando]]></dc:creator>
		<pubDate>Wed, 25 Oct 2023 08:31:38 +0000</pubDate>
				<category><![CDATA[Intune]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">https://superusertips.com/?p=229</guid>

					<description><![CDATA[<p>There was a recent issue where an active device did not report its last check-in date in Intune even though it was actively checking in. No issue with performing sync&#46;&#46;&#46;</p>
<p>The post <a href="https://superusertips.com/2023/10/intune-last-check-in-date-not-updating-for-windows-device/">Intune Last Check-in date not updating for Windows device</a> appeared first on <a href="https://superusertips.com">SuperUserTips</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>There was a recent issue where an active device did not report its last check-in date in Intune even though it was actively checking in. No issue with performing sync from access work or school settings, app deployment and OS updates on the device. No errors are being logged in event logs either. Since device was not reporting its Last Check-in time to Intune, it caused an issue with compliance as device is now marked non-compliant in Intune for no check-in over 60 days.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="264" src="https://superusertips.com/wp-content/uploads/2023/10/image-5-1024x264.png" alt="" class="wp-image-233" srcset="https://superusertips.com/wp-content/uploads/2023/10/image-5-1024x264.png 1024w, https://superusertips.com/wp-content/uploads/2023/10/image-5-300x77.png 300w, https://superusertips.com/wp-content/uploads/2023/10/image-5-768x198.png 768w, https://superusertips.com/wp-content/uploads/2023/10/image-5-920x237.png 920w, https://superusertips.com/wp-content/uploads/2023/10/image-5.png 1050w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Ultimately, it all came down to one of the windows service that was not running or in disabed state.</p>



<span id="more-229"></span>



<p><code>DmWapPushService</code> : (<em>&#8220;Device Management Wireless Application Protocol (WAP) Push message Routing Service&#8221;</em>) , a required service for Intune to properly communicate with clients</p>



<h3 class="wp-block-heading">Resolution:</h3>



<p>Check and enable the <code>DmWapPushService</code> service:</p>



<ul class="wp-block-list">
<li><strong>Openservices.msc</strong>&nbsp;console<br><img loading="lazy" decoding="async" width="300" height="219" class="wp-image-241" style="width: 300px;" src="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-3-1.png" alt="" srcset="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-3-1.png 617w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-3-1-300x219.png 300w" sizes="auto, (max-width: 300px) 100vw, 300px" /><br></li>



<li>Under services list,&nbsp;<strong>Right-click</strong>&nbsp;service name&nbsp;<em>&#8220;Device Management Wireless Application Protocol (WAP) Push message Routing Service&#8221;</em>&nbsp;and&nbsp;<strong>select&nbsp;</strong>Properties. In the General tab of properties dialog box,&nbsp;<strong>select</strong>&nbsp;Automatic (Delayed Start) as startup type.<br><img loading="lazy" decoding="async" width="800" height="185" class="wp-image-243" style="width: 800px;" src="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image.png" alt="" srcset="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image.png 2128w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-300x69.png 300w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-1024x237.png 1024w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-768x178.png 768w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-1536x355.png 1536w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2048x474.png 2048w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-920x213.png 920w" sizes="auto, (max-width: 800px) 100vw, 800px" /><br><img loading="lazy" decoding="async" width="150" height="176" class="wp-image-244" style="width: 150px;" src="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-1.png" alt="" srcset="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-1.png 682w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-1-255x300.png 255w" sizes="auto, (max-width: 150px) 100vw, 150px" /><br></li>



<li><strong>Hit</strong>&nbsp;OK<br></li>
</ul>



<ul class="wp-block-list">
<li>Verify that another required service &#8220;Microsoft Intune Management Extension&#8221; is enabled with startup type as &#8220;<em>Automatic (Delayed Start</em>)&#8221; as well and in running state.<br><img loading="lazy" decoding="async" width="800" height="137" class="wp-image-242" style="width: 800px;" src="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2.png" alt="" srcset="https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2.png 2096w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2-300x51.png 300w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2-1024x175.png 1024w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2-768x131.png 768w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2-1536x262.png 1536w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2-2048x350.png 2048w, https://superusertips.com/wp-content/uploads/2023/10/Pasted-image-2-920x157.png 920w" sizes="auto, (max-width: 800px) 100vw, 800px" /></li>
</ul>



<ul class="wp-block-list">
<li>Once the above services are in desired state,<strong>&nbsp;Reboot</strong>&nbsp;and&nbsp;<strong>initiate</strong>&nbsp;a check-in with Intune<strong>.</strong>&nbsp;After 5-10 mins, the last check-in time should be updating with no issues</li>
</ul>



<p class="has-small-font-size"><strong>Microsoft reference:</strong><br><a href="https://learn.microsoft.com/en-us/troubleshoot/mem/intune/device-management/cannot-sync-windows-10-devices?id=5004252">https://learn.microsoft.com/en-us/troubleshoot/mem/intune/device-management/cannot-sync-windows-10-devices?id=5004252</a> </p>
<p>The post <a href="https://superusertips.com/2023/10/intune-last-check-in-date-not-updating-for-windows-device/">Intune Last Check-in date not updating for Windows device</a> appeared first on <a href="https://superusertips.com">SuperUserTips</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://superusertips.com/2023/10/intune-last-check-in-date-not-updating-for-windows-device/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
