{"id":3313,"date":"2019-10-22T17:27:21","date_gmt":"2019-10-22T16:27:21","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=3313"},"modified":"2019-10-22T17:27:21","modified_gmt":"2019-10-22T16:27:21","slug":"delete-user-profiles-older-than-a-specified-number-of-days-on-system-restart-through-intune","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2019\/10\/delete-user-profiles-older-than-a-specified-number-of-days-on-system-restart-through-intune\/","title":{"rendered":"Delete User Profiles Older than a Specified Number of Days on System Restart through Intune"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The good old Group Policy &#8220;Configuration\\Policies\\Administrative Templates\\System\\User Profiles\\<em>Delete User Profiles Older than a Specified Number of Days on System Restart<\/em> &#8221; isn&#8217;t part of Intune yet.<br><br>If you use shared devices in your environment, you can use below script to set the number of days after which a user profile is cleaned up on Windows 10 MDM \/ Intune managed.<br><br>It has to run under SYSTEM context or it won&#8217;t be allowed to write the right key.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"385\" height=\"174\" src=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2019\/10\/execute-as-system.jpg\" alt=\"\" class=\"wp-image-3314\" srcset=\"https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2019\/10\/execute-as-system.jpg 385w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2019\/10\/execute-as-system-300x136.jpg 300w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Download:  <a href=\"https:\/\/gitlab.com\/Lieben\/assortedFunctions\/blob\/master\/set-CleanupUserProfilesAfterDays.ps1\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">https:\/\/gitlab.com\/Lieben\/assortedFunctions\/blob\/master\/set-CleanupUserProfilesAfterDays.ps1<\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The good old Group Policy &#8220;Configuration\\Policies\\Administrative Templates\\System\\User Profiles\\Delete User Profiles Older than a Specified Number of Days on System Restart &#8221; isn&#8217;t part of Intune yet. If you use shared devices in your environment, you can use below script to set the number of days after which a user profile is cleaned up on Windows &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2019\/10\/delete-user-profiles-older-than-a-specified-number-of-days-on-system-restart-through-intune\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Delete User Profiles Older than a Specified Number of Days on System Restart through Intune<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[12,22,39,1],"tags":[],"class_list":["post-3313","post","type-post","status-publish","format-standard","hentry","category-ems","category-intune","category-powershell","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=3313"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3313\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=3313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=3313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=3313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}