{"id":5479,"date":"2023-12-04T09:09:22","date_gmt":"2023-12-04T07:09:22","guid":{"rendered":"https:\/\/www.msb365.blog\/?p=5479"},"modified":"2023-12-08T13:12:05","modified_gmt":"2023-12-08T11:12:05","slug":"delete-outlook-cache-with-ms-intune","status":"publish","type":"post","link":"https:\/\/www.msb365.blog\/?p=5479","title":{"rendered":"Delete Outlook cache with Microsoft Intune"},"content":{"rendered":"<p>There are various reasons why the Outlook cache needs to be deleted. One of the most common reasons is after a migration, for example to Exchange online.<br \/>\nThe Outlook cache can be deleted in various ways. However, as an administrator, we are interested in doing this centrally from one place.<\/p>\n<p>In this article, I would like to point out two ways and describe a third way in more detail, as a kind of documentation.<\/p>\n<p>&nbsp;<\/p>\n<h3>Variant 1: (The Sneaker)<\/h3>\n<p>If the Outlook cache only needs to be deleted for individual users, this can be done with one of my scripts. The script with the name: ClearOutlookCache_M.ps1 (the GitHub link follows at the end of the article) is prepared for you.<\/p>\n<p>The script works by first checking whether the path: <span style=\"color: #800000;\"><strong>C:\\MDM\\Logging<\/strong><\/span> exists, if this is not the case, this path is created.<br \/>\nThe background to this is that a transcript is also created when the script is executed.<\/p>\n<p>The system then checks whether the corresponding registry key exists. If this is the case, the script asks whether we really want to delete the corresponding key.<br \/>\nIf this query is confirmed with &#8220;Y&#8221;, the key is deleted.<br \/>\nOutlook can then be restarted and the profile is set up again with Autodiscover.<\/p>\n<p>&nbsp;<\/p>\n<h3>Variant 2: (GPO)<\/h3>\n<p>During a migration, after which the deletion of Outlook profiles is generally recommended, we can also delete the cache using GPO settings. I wrote an article about this on Techgenix some time ago.<br \/>\nYou can find out how to do this under the following link to my article:<\/p>\n<p>https:\/\/techgenix.com\/creating-a-new-outlook-profile-without-user-involvement\/<\/p>\n<div class=\"vlp-link-container vlp-layout-basic\"><a href=\"https:\/\/techgenix.com\/creating-a-new-outlook-profile-without-user-involvement\/\" class=\"vlp-link\" title=\"Creating a New Outlook Profile without User Involvement\" rel=\"nofollow\" target=\"_blank\"><\/a><div class=\"vlp-layout-zone-side\"><div class=\"vlp-block-2 vlp-link-image\"><img decoding=\"async\" style=\"max-width: 150px;\" width=\"150\" height=\"150\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/01\/TechGenix_ONLY_LOGO.jpg\" class=\"attachment-150x999 size-150x999\" alt=\"\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/01\/TechGenix_ONLY_LOGO.jpg 308w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/01\/TechGenix_ONLY_LOGO-150x150.jpg 150w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/01\/TechGenix_ONLY_LOGO-300x300.jpg 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2019\/01\/TechGenix_ONLY_LOGO-100x100.jpg 100w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/div><\/div><div class=\"vlp-layout-zone-main\"><div class=\"vlp-block-0 vlp-link-title\">Creating a New Outlook Profile without User Involvement<\/div><div class=\"vlp-block-1 vlp-link-summary\">During Exchange migrations my colleagues and I encounter various challenges. One of the most common  issues (at least for us) is that after a mail migration users need a new Outlook profile, but not a new Windows profile. In this article I would like to describe a simple solution how to create a new Outlook profile remotely without the user having to do anything manually.<\/div><\/div><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>Variant 3: (MS Intune)<\/h3>\n<p>I have also prepared a script for you for this variant. The script with the name: ClearOutlookCache_M.ps1 works as follows:<\/p>\n<p>In the first step, the script checks whether the directory: <strong><span style=\"color: #800000;\">C:\\MDM\\Logging<\/span><\/strong> exists, if not, this directory is created, similar to the ClearOutlookCache_M.ps1 script.<br \/>\nThe script then checks whether the following registry key exists: <strong><span style=\"color: #800000;\">HKCU:Software\\Microsoft\\MSB365_Outlook_clear_cache_Tool<\/span><\/strong>.<br \/>\nIf this entry exists, the script terminates and makes no further changes (except for the corresponding log file in the previously defined path).<\/p>\n<p>If the registry key does not exist, the Outlook cache is deleted and then the key &#8220;<strong><span style=\"color: #800000;\">HKCU:Software\\Microsoft\\MSB365_Outlook_clear_cache_Tool<\/span><\/strong>&#8221; is created.<\/p>\n<p>As this script is executed via MS Intune, this key ensures that the Outlook cache is not deleted each time the user logs in.<\/p>\n<p>Conversely, this means for the administrators that if the cache is to be deleted again, this registry must be deleted beforehand.<\/p>\n<p>The configuration of Intune so that this script is cancelled is as follows:<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"301\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-5487\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422.png\" alt=\"\" width=\"2437\" height=\"1658\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422.png 2437w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422-300x204.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422-1024x697.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422-768x523.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422-1536x1045.png 1536w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422-2048x1393.png 2048w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-105422-1320x898.png 1320w\" sizes=\"(max-width: 2437px) 100vw, 2437px\" \/><\/td>\n<td width=\"301\">In the Intune portal we go to <strong>Devices<\/strong> &gt; <strong>Scripts<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"301\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5488\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110047.png\" alt=\"\" width=\"1291\" height=\"805\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110047.png 1291w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110047-300x187.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110047-1024x639.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110047-768x479.png 768w\" sizes=\"(max-width: 1291px) 100vw, 1291px\" \/><\/td>\n<td width=\"301\">Here we add a new <strong>PowerShell<\/strong> script.<\/td>\n<\/tr>\n<tr>\n<td width=\"301\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5489\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110206.png\" alt=\"\" width=\"1351\" height=\"789\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110206.png 1351w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110206-300x175.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110206-1024x598.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110206-768x449.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110206-1320x771.png 1320w\" sizes=\"(max-width: 1351px) 100vw, 1351px\" \/><\/td>\n<td width=\"301\">Define name.<\/td>\n<\/tr>\n<tr>\n<td width=\"301\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5490\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110306.png\" alt=\"\" width=\"1408\" height=\"868\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110306.png 1408w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110306-300x185.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110306-1024x631.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110306-768x473.png 768w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110306-1320x814.png 1320w\" sizes=\"(max-width: 1408px) 100vw, 1408px\" \/><\/td>\n<td width=\"301\">Distribute the script with the settings shown.<\/td>\n<\/tr>\n<tr>\n<td width=\"301\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5491\" src=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110321.png\" alt=\"\" width=\"1196\" height=\"803\" srcset=\"https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110321.png 1196w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110321-300x201.png 300w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110321-1024x688.png 1024w, https:\/\/msb365.abstergo.ch\/wp-content\/uploads\/2023\/11\/Screenshot-2023-11-30-110321-768x516.png 768w\" sizes=\"(max-width: 1196px) 100vw, 1196px\" \/><\/td>\n<td width=\"301\">Define assignment.<\/p>\n<p>Done.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>GitHub<\/h3>\n<p>You can find the two scripts and a short readme under the following link:<\/p>\n<p>&nbsp;<\/p>\n<div class=\"vlp-link-container vlp-layout-basic\"><a href=\"https:\/\/github.com\/MSB365\/ClearOutlookCache\" class=\"vlp-link\" title=\"GitHub - MSB365\/ClearOutlookCache\" rel=\"nofollow\" target=\"_blank\"><\/a><div class=\"vlp-layout-zone-side\"><div class=\"vlp-block-2 vlp-link-image\"><img decoding=\"async\" src=\"https:\/\/opengraph.githubassets.com\/6d0628c01c47fd48bf8ba0cd595a0e94dda177631f385c3dc2d53786331e152f\/MSB365\/ClearOutlookCache\" style=\"max-width: 150px; max-height: 150px\" \/><\/div><\/div><div class=\"vlp-layout-zone-main\"><div class=\"vlp-block-0 vlp-link-title\">GitHub - MSB365\/ClearOutlookCache<\/div><div class=\"vlp-block-1 vlp-link-summary\">Contribute to MSB365\/ClearOutlookCache development by creating an account on GitHub.<\/div><\/div><\/div>\n<h3><\/h3>\n<h3>Conclusion<\/h3>\n<p>As with all my scripts, the following principles apply:<br \/>\nThe script can be used free of charge as described in the licence conditions. Changes are also allowed. However, when distributing or using the individual modules, reference must be made to this article and the MSB365 blog.<br \/>\nI strongly recommend testing the script in a LAB the first time you use it.<br \/>\nLikewise, I assume no liability for possible damage that the script may cause.<br \/>\nIt is not allowed to pass on this script or single modules to third parties against payment. We follow the approach: From the community, for the community.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are various reasons why the Outlook cache needs to be deleted. One of the most common reasons is after a migration, for example to Exchange online. The Outlook cache can be deleted in various ways. However, as an administrator, we are interested in doing this centrally from one place. In this article, I would [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5494,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1923,2,1988,3],"tags":[],"class_list":["post-5479","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-365","category-exchange","category-ms-intune","category-powershell"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/5479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5479"}],"version-history":[{"count":6,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/5479\/revisions"}],"predecessor-version":[{"id":5493,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/posts\/5479\/revisions\/5493"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=\/wp\/v2\/media\/5494"}],"wp:attachment":[{"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.msb365.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}