Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $dEntry = New-Object DirectoryServices.DirectoryEntry("LDAP://xyz.com/cn=sites,cn=configuration,dc=xyz,dc=com","user1","Pass1");
- $searcher=New-Object DirectoryServices.DirectorySearcher($dEntry);
- $searcher.Filter="(objectClass=siteLink)";
- $searcher.PropertiesToLoad.Add("siteList");
- $searcher.PropertiesToLoad.Add("cost");
- $searcher.PropertiesToLoad.Add("replInterval");
- $searcher.PropertiesToLoad.Add("cn");
- $searcher.FindAll() |%{
- $count=$_.Properties.sitelist.Count;
- $p=@{"cn"=[string]$_.Properties.cn; "sites"=$count;};
- if ($count>2) {
- $p["mesh"]=$count;
- }else{
- $p["mesh"]=$count*$count;
- }
- New-Object psobject -Property $p
- }
Add Comment
Please, Sign In to add comment