ADの操作:属性による検索SIDHistory

Active Directoryの属性sIDHistoryを操作する方法に注目してください。 つまり、この属性によってオブジェクトを検索します。

しかし、最初に、属性自体について話しましょう。 sIDHistoryは、Active Directoryでオブジェクトの通信を作成するために使用されます;たとえば、あるドメイン/フォレストから別のドメイン/フォレストにアカウントとグループを移行する場合に必要です。

これにより何が得られますか? また、これにより、リソースに権利を再割り当てするのではなく、リソースを「そのまま」残す機会が与えられます。
例:A.localドメインにはA-G1グループがあり、ユーザーA-U1はそのメンバーです。
グループA-G1にアクセスが割り当てられるファイルリソース\\ server01 \共有があります

そのため、B.localドメインに移行し、そこでユーザーB-U1を作成し、ユーザーA \ A-U1からsIDHistory属性を登録しました

これで、ユーザーB \ B-U1は追加のアクションなしで\\ server01 \ shareにログインできます。

5000人のユーザーが移行し、一部のユーザーの名前が完全に変更され、sIDHistoryが管理者に明確でない一連の数字のように見えるとします。 ドメインAのどのユーザーがドメインBのユーザーに対応するかを見つけることは、単に不可能です。

すべてのオブジェクトを指定された属性に出力するQUESTコマンドレットを使用したPowershellスクリプト。

# ,     sIDHistory $user="B-U1" #     AD $obj=(Get-qADObject -Identity $user -service "B.local" -includedproperties sIDHistory | select name,dn,sIDHistory) # LDAP  $ldap="LDAP://{0}" -f $obj.dn #  .NET,    SID $indents=([ADSI]$ldap).getex(“sidhistory”) | % { (new-object System.Security.Principal.SecurityIdentifier $_ ,0).value } #   sIDHistory     ,    foreach ($indent in $indents) { get-qadobject -identity $indent -service "A.local" } 


スクリプトの条件:


入り口で、CSVとグループからのアンロードの両方を送信できます。
users.txt:
お名前
B-u1


 import-csv -delimiter "`t" -path "users.txt" | % { # ,     sIDHistory $user=$_.name #     AD $obj=(Get-qADObject -Identity $user -service "B.local" -includedproperties sIDHistory | select name,dn,sIDHistory) # LDAP  $ldap="LDAP://{0}" -f $obj.dn #  .NET,    SID $indents=([ADSI]$ldap).getex(“sidhistory”) | % { (new-object System.Security.Principal.SecurityIdentifier $_ ,0).value } #   sIDHistory     ,    foreach ($indent in $indents) { get-qadobject -identity $indent -service "A.local" } } 

Source: https://habr.com/ru/post/J122753/


All Articles