0
나는이 스크립트가 상호 도메인에서 작동합니다.Powershell은 그룹에서 사용자를 제거합니다
그것은 도메인 A로부터 사용자 SID를 검색하고이 SID 후 존재하는 특정 그룹에 대해 도메인 A를 점검 I 원하는
#Connects to Domain A with admin credentials
Connect-QADService -Service DomainA.local -Credential domaina\
#gets username to work with
$user = Read-Host "Enter the users DomainA Username" Set-QADUser $user
#figures out the specific groups that need to be updated with the Domain A user
$UserXGroups = (Get-QADUser -Identity $user).MemberOf | Get-QADGroup | where {$_.Name -like "SG-*XX*" -or $_.Name -like "XX_*"} | select Name, DN, NTAccountName
#find DomainA user
$DomainAAccount = Read-Host "Confirm the users DomainA Username"
$Domainuser = Get-QADUser $DomainAAccount -Service DomainA.local
#Adds DomainA user to DomainB groups
Connect-QADService -Service DomainB.com -Credential domainb\
foreach($i in $UserXXGroups){
Add-QADGroupMember -Identity $i.Name -Member $DomainAuser | Out-Null
$i.NTAccountName
}
Write-Host "DomainA\$user added to above DomainB groups"
도메인 B에 동일한 그룹에 도메인 A SID 추가 도메인 A 사용자를 도메인 B 그룹에 추가하기 전에 모든 그룹 도메인 B 특정 그룹을 제거하려고합니다.
으로 우리 것이다 마스터로 도메인 A를 사용에 따라 도메인 B 그룹에 사용자를 추가하는 일이 뭐죠 도메인 A. 이해
합니까에 탭의 멤버? 필요한 경우 명확히 할 수 있습니다 .... 어떤 도움을 주시면 감사하겠습니다. 나는 당신을 가정하고
만 특정 우리는 검색하지만, 그래 맞아 그룹 : 경우에 – user2707263
그냥 어디 일치를 추가하지 Get-QADGroup | 여기서 {$ _. name -notmatch 'groupA'} | Remove-QADGroupMember -member $ user –