Kae Travis

Reapply the Cloud Policy for Microsoft 365 using PowerShell

This blog provides an example of how we can reapply the cloud policy for Microsoft 365 using PowerShell.

If you make an update to a cloud policy in your Microsoft tenant, you may not want to wait for it to apply to a users machine.  By using the script below, we can force the user to reach out and re-apply the cloud policy for Microsoft 365 applications.  After the running the script, ask the user to close and re-launch their Microsoft 365 applications and monitor HKCU\Software\Policies\Microsoft\Cloud.

$computerName = "xxxx"
Invoke-Command -ComputerName $computerName -ScriptBlock {
    foreach($sid in Get-ChildItem -Path "Registry::HKEY_USERS") {
        $keypath = "Registry::$sid\Software\Microsoft\Office\16.0\Common\CloudPolicy"  
        if (test-path $keypath) {
            write-host "Deleting $keypath"
            Remove-Item -Path $keypath -Recurse -Force
        }
    }    
}

 

Reapply the Cloud Policy for Microsoft 365 using PowerShell
Reapply the Cloud Policy for Microsoft 365 using PowerShell

Leave a Reply