{"id":155,"date":"2022-05-08T07:11:52","date_gmt":"2022-05-08T07:11:52","guid":{"rendered":"https:\/\/standingtech.com\/randomarticles\/?p=155"},"modified":"2022-05-08T07:18:51","modified_gmt":"2022-05-08T07:18:51","slug":"powershell-remove-users-from-ad-group-csv","status":"publish","type":"post","link":"https:\/\/standingtech.com\/randomarticles\/powershell-remove-users-from-ad-group-csv\/","title":{"rendered":"PowerShell Remove Users from Ad Group CSV"},"content":{"rendered":"<p>Write-Host &#8220;Removing users from an AD group.&#8221;<br \/>\nImport-Csv &#8220;Path\\to\\file\\users.csv&#8221; | ForEach-Object {<br \/>\n$user = $_.email<br \/>\n$aduserinfo = Get-ADUser -Filter &#8220;EmailAddress -eq &#8216;$user'&#8221;<br \/>\nRemove-ADGroupMember -Identity &#8220;GroupName&#8221; -Members $aduserinfo -Confirm:$false<br \/>\nWrite-Host &#8220;User $user successfully removed from the AD group&#8221;<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Write-Host &#8220;Removing users from an AD group.&#8221; Import-Csv &#8220;Path\\to\\file\\users.csv&#8221; | ForEach-Object { $user = $_.email $aduserinfo = Get-ADUser -Filter &#8220;EmailAddress -eq &#8216;$user&#8217;&#8221; Remove-ADGroupMember -Identity &#8220;GroupName&#8221; -Members $aduserinfo -Confirm:$false Write-Host &#8220;User $user successfully removed from the AD group&#8221; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[52,25,53],"class_list":["post-155","post","type-post","status-publish","format-standard","hentry","category-active-directory","tag-ad-group","tag-powershell","tag-remove-user"],"_links":{"self":[{"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/posts\/155","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/comments?post=155"}],"version-history":[{"count":1,"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/posts\/155\/revisions"}],"predecessor-version":[{"id":156,"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/posts\/155\/revisions\/156"}],"wp:attachment":[{"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/media?parent=155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/categories?post=155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/standingtech.com\/randomarticles\/wp-json\/wp\/v2\/tags?post=155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}