Guest User

Untitled

a guest
Nov 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $dEntry = New-Object DirectoryServices.DirectoryEntry("LDAP://xyz.com/cn=sites,cn=configuration,dc=xyz,dc=com","user1","Pass1");
  2. $searcher=New-Object DirectoryServices.DirectorySearcher($dEntry);
  3. $searcher.Filter="(objectClass=siteLink)";
  4. $searcher.PropertiesToLoad.Add("siteList");
  5. $searcher.PropertiesToLoad.Add("cost");
  6. $searcher.PropertiesToLoad.Add("replInterval");
  7. $searcher.PropertiesToLoad.Add("cn");
  8. $searcher.FindAll() |%{
  9. $count=$_.Properties.sitelist.Count;
  10. $p=@{"cn"=[string]$_.Properties.cn; "sites"=$count;};
  11. if ($count>2) {
  12. $p["mesh"]=$count;
  13. }else{
  14. $p["mesh"]=$count*$count;
  15. }
  16. New-Object psobject -Property $p
  17. }
Add Comment
Please, Sign In to add comment