如何使用System.DirectoryServices命名空间将用户从一个OU移动到另一个?System.DirectoryServices命名空间 - >移动用户OU?
我知道如何通过CMDLETs和旧的PSBase.moveto方式。这是唯一的方法吗?我试图避免CMDlets和PSBase.moveto。
奔看着http://msdn.microsoft.com/en-us/library/gg145037.aspx
任何人都知道吗?
如何使用System.DirectoryServices命名空间将用户从一个OU移动到另一个?System.DirectoryServices命名空间 - >移动用户OU?
我知道如何通过CMDLETs和旧的PSBase.moveto方式。这是唯一的方法吗?我试图避免CMDlets和PSBase.moveto。
奔看着http://msdn.microsoft.com/en-us/library/gg145037.aspx
任何人都知道吗?
给你:
# MoveObject
$OuDest=[ADSI] "LDAP://mach:389/ou=Commerciaux,dc=societe,dc=fr"
$objUODest.MoveHere("LDAP://cn=Mickey,ou=Ventes,dc=societe,dc=fr", “cn=Mickey")
而且
# Rename
$Ou=[adsi] "LDAP://mach:389/ou=Ventes,dc=societe,dc=fr"
$Ou.MoveHere("LDAP://cn=PetitMickey,ou=Ventes,dc=societe,dc=fr", "cn=PetitMickeyBis")
编辑
如果您需要authentify:
$OuDest = New-Object System.DirectoryServices.DirectoryEntry ("LDAP://FQDN name or @IP",$User,$password)
$OuDest = New-Object System.DirectoryServices.DirectoryEntry ("LDAP://mach:389/ou=Commerciaux,dc=societe,dc=fr",$User,$password)
我不断收到访问被拒绝。我需要通过该域名上的我的SU帐户运行命令,我不知道要在$ username和$ password变量中保留哪些位置:/ – 2012-02-17 14:32:11
我编辑以解释如何验证。 – JPBlanc 2012-02-17 14:40:42
除非我错过了一些东西,这不是你已经问过的同一个问题吗? – EBGreen 2012-02-17 13:49:55
[Powershell NON-Cmdlet:通过System.DirectoryServices命名空间将用户移动到新的OU]的可能重复(http://stackoverflow.com/questions/9315209/powershell-non-cmdlet-move-user-to-new-ou- via-system-directoryservices-namespac) – EBGreen 2012-02-17 13:51:03
啊,是啊,现在当我再次看了以为它被删除了!这个问题的原因是因为我必须在其他域中注册我的su帐户。 – 2012-02-17 14:31:12