{"id":37935,"date":"2025-05-02T00:04:21","date_gmt":"2025-05-01T22:04:21","guid":{"rendered":"http:\/\/159.69.82.204\/win\/?p=37935"},"modified":"2025-05-01T22:08:24","modified_gmt":"2025-05-01T20:08:24","slug":"powershell-script-cleanup-admincount","status":"publish","type":"post","link":"https:\/\/borncity.com\/win\/2025\/05\/02\/powershell-script-cleanup-admincount\/","title":{"rendered":"PowerShell Script Cleanup-AdminCount"},"content":{"rendered":"<p><img decoding=\"async\" style=\"margin: 0px 10px 0px 0px; display: inline; float: left;\" title=\"Windows\" src=\"https:\/\/www.borncity.com\/blog\/wp-content\/uploads\/2021\/04\/Windows-klein.jpg\" alt=\"Windows\" width=\"200\" align=\"left\" \/>[<a href=\"https:\/\/www.borncity.com\/blog\/2025\/05\/02\/powershell-cleanup-admincount-script\/\" target=\"_blank\" rel=\"noopener\">German<\/a>]A little tip for administrators of Windows systems. Mark Heitbrink has sat down and built a small PowerShell script that checks the Active Directory under Windows for orphaned administrator accounts and cleans the system of such corpses. The PowerShell script can do a few more things.<\/p>\n<p><!--more--><\/p>\n<p>Recently I came across a post by Mark Heitbrink on Facebook in a group called <em>gruppenrichtlinien. <\/em>Thought to share it here within the blog.<\/p>\n<p><a href=\"https:\/\/github.com\/gruppenrichtlinien\/Cleanup-AdminCount\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.postimg.cc\/9FN2ZYCs\/image.png\" alt=\"Cleanup-AdminCount PS script\" width=\"640\" height=\"522\" \/><\/a><\/p>\n<p>Mark has provided the PowerShell script Cleanup-AdminCount on <a href=\"https:\/\/github.com\/gruppenrichtlinien\/Cleanup-AdminCount\" target=\"_blank\" rel=\"noopener\">GitHub<\/a> and wrote about his solution:<\/p>\n<blockquote><p>A language independent(!) Powershell Script to remove orphaned AdminCounts on User objects in AD and enable ACL inheritance. Repair User Accounts, protected by sdprop\/AdminSDHolder process in Active Directory, that are no longer Member of Protected Groups<\/p><\/blockquote>\n<p>The script, which is provided under MIT license, does not initially work with the display name of the group but uses the Well-Known SID. Details on the functions and how to call them can be found on the GitHut page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[German]A little tip for administrators of Windows systems. Mark Heitbrink has sat down and built a small PowerShell script that checks the Active Directory under Windows for orphaned administrator accounts and cleans the system of such corpses. The PowerShell script &hellip; <a href=\"https:\/\/borncity.com\/win\/2025\/05\/02\/powershell-script-cleanup-admincount\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[580,2],"tags":[376,194],"class_list":["post-37935","post","type-post","status-publish","format-standard","hentry","category-security","category-windows","tag-powershell","tag-windows"],"_links":{"self":[{"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/posts\/37935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/comments?post=37935"}],"version-history":[{"count":1,"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/posts\/37935\/revisions"}],"predecessor-version":[{"id":37936,"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/posts\/37935\/revisions\/37936"}],"wp:attachment":[{"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/media?parent=37935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/categories?post=37935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/borncity.com\/win\/wp-json\/wp\/v2\/tags?post=37935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}