KanoInglewood
MIS
I am new to scripting and I was given a task to write a PowerShell script to check for what domain controllers all PCs in our enterprise are using for authentication and have the data exported to a file. With some help, I have a script below and I would like to know your feedback on whether this script will accomplish what I am tasked with.
Get-ADDomainController -Filter * | Select-Object -Property Name -searchbase "OU=yourcomputerOU,DC=domain,DC=com" | %{(Get-WmiObject -Class win32_ntdomain -Filter "DomainName = 'mydomain'" -ComputerName $_.Name).DomainControllerName}
Thanks,
Kano
Get-ADDomainController -Filter * | Select-Object -Property Name -searchbase "OU=yourcomputerOU,DC=domain,DC=com" | %{(Get-WmiObject -Class win32_ntdomain -Filter "DomainName = 'mydomain'" -ComputerName $_.Name).DomainControllerName}
Thanks,
Kano