I have many failover cluster instances that should not be displayed during the LDAP search because they are not real servers and I only want to update real servers. ;)
In AD, these objects are created with the description "Failover cluster virtual network name account".
I have changed "$uiHash.LoadADButton.Add_Click" to hide these objects.
I have many failover cluster instances that should not be displayed during the LDAP search because they are not real servers and I only want to update real servers. ;) In AD, these objects are created with the description "Failover cluster virtual network name account".
I have changed "$uiHash.LoadADButton.Add_Click" to hide these objects.
LoadADButton Events
$uiHash.LoadADButton.Add_Click({ $domain = Open-DomainDialog $uiHash.StatusTextBox.Foreground = "Black" $uiHash.StatusTextBox.Text = "Querying Active Directory for Computers..." $Searcher = [adsisearcher]""
$Searcher.SearchRoot= [adsi]"LDAP://$domain" $Searcher.Filter = ("(&(objectCategory=computer)(OperatingSystem=server))") $Searcher.PropertiesToLoad.Add('name') | Out-Null $Searcher.PropertiesToLoad.Add('description') | Out-Null Write-Verbose "Checking for exempt list" If (Test-Path Exempt.txt) { Write-Verbose "Collecting systems from exempt list" [string[]]$exempt = Get-Content Exempt.txt } $Results = $Searcher.FindAll() foreach ($result in $Results) { IF ($result.Properties.Item('description') -eq 'Failover cluster virtual network name account'){ continue } [string]$computer = $result.Properties.name If ($Exempt -notcontains $computer -AND -NOT $ComputerCache.contains($Computer)) { [void]$ComputerCache.Add($Computer) $clientObservable.Add(( New-Object PSObject -Property @{ Computer = $computer Audited = 0 -as [int] Installed = 0 -as [int] InstallErrors = 0 -as [int] Services = 0 -as [int] Notes = $Null } ))
} Else { Write-Verbose "Excluding $computer" } } $uiHash.ProgressBar.Maximum = $uiHash.Listview.ItemsSource.count
$Global:clients = $clientObservable | Select -Expand Computer Show-DebugState
})