I was tasked with writing a script (see below) to determine which domain controllers all computers are using for authentication.
Get-ADComputer -filter * -Searchbase “OU=ourcomputerOU,DC=domain,DC=AD” | %{Get-WmiObject -Class win32_ntdomain -Filter “DomainName = ‘ourdomain’” -ComputerName $_.Name} | Export-csv c:\temp\logon.csv
After I ran the script and based on how large our organization is and the number of computers that are deployed, I thought I would have seen more computers listed in my output file logon.csv. The following errors below repeat multiple times as the script is running. I ran the script during different hours of the day with the same results. What stands out is “The RPC server is unavailable.” Any comments or suggestion will be appreciated.
Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:1 char:79
- … ,DC=AD" | %{Get-WmiObject -Class win32_ntdomain -Filter "DomainName = …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: ( [Get-WmiObject], COMException
- FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Thanks,
Kano