方式一:從組中移除用戶 1. 導(dǎo)出或者整理出需要移除組的用戶到CSV中,檢驗 Import-Csv C:\1\us.csv | ForEach-Object { Try {[array]$list += Get-ADUser -Identity $_.user} Catch { $_.Exception } } 2. 從組中移除用戶 remove-ADGroupMember -Identity 'group01' -Members $list 方式二:從組中移除單個用戶 Remove-adgroupmember -identity group02 -members san_zhang 方式三:從組中移除單個用戶 for /f ""skip=1 eol=;tokens=1-3 delims=,"" %%a in (E:\disuser.csv) do foreach{remove-adgroupmember -identity group02 -members %%a -confirm:$false}" |
|
來自: tycoondeng > 《AD域》