#导出计算机信息
csvde -l "cn,objectclass,description" -r "objectClass=computer" -d "ou=server,ou=admin,dc=testj,dc=com" -f d:\computerss.txt -U$computers = select-string -path d:\computerss.txt -Pattern "objectclass","organizationalunit" -NotMatchforeach ($computer in $computers) { $computer.Line.Split("""")[2].Split(",")[2] |Out-File D:\computername.txt }Remove-Item d:\computerss.txt #只导出用户信息csvde -l "cn,objectclass,description" -r "(&(objectcategory=person)(objectClass=user))" -d "ou=server,ou=admin,dc=testj,dc=com" -f d:\users.txt -Ugc d:\users.txt