简体   繁体   English

如何导出和导入AD用户,组和组成员身份?

[英]How to Export and Import AD Users, Groups and Group Membership?

Hallo, I want to copy my Active Directory Users, Groups and Group Memberships from one DC to another using csvde, where the machines are identical except for the only the name of the Domain and Machine. 您好,我想使用csvde将Active Directory用户,组和组成员资格从一个DC复制到另一个DC,其中,除了域和计算机的唯一名称以外,其他计算机是相同的。 Note that each server is a DC and itself is the only member of the domain. 请注意,每个服务器都是DC,它本身是域的唯一成员。 The command I am using for export is: 我用于导出的命令是:

csvde -f C:\exportAD.csv -m -n -o "primaryGroupID,lockoutTime" -j C:\Logs\

I then edit the csv file, deleting a few lines which will not import, and changing the Domain and Machine name, then import it on the second machine using: 然后,我编辑csv文件,删除一些将不会导入的行,并更改域和计算机名称,然后使用以下命令将其导入第二台计算机:

csvde -i -f C:\exportAD.csv -k -j C:\Logs\

However, this does not the group memberships present in the original. 但是,这不是原始成员中存在的组成员身份。

Any ideas? 有任何想法吗?

-Frink -皱纹

$Groups = Get-ADGroup -Filter * -SearchBase "DC=<DC Path>"
$Results = foreach( $Group in $Groups ){    
    Get-ADGroupMember -Identity $Group | foreach {    
        [pscustomobject]@{    
            GroupName = $Group.Name    
            Name = $_.Name    
            }    
        }    
    }    
$Results

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM