Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide Failover cluster virtual network name accounts #24

Open
JohnCroix opened this issue Apr 3, 2018 · 0 comments
Open

hide Failover cluster virtual network name accounts #24

JohnCroix opened this issue Apr 3, 2018 · 0 comments

Comments

@JohnCroix
Copy link

JohnCroix commented Apr 3, 2018

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
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant