Query Domain Controller Powershell
Powershell query lastlogondate lastlogontimestamp returning mostly blank values not matching the adsiedit value for corresponding user attribute 3.
Query domain controller powershell. Basically you can get list of all domain controllers from your domain using just two commands. You just need active directory powershell module installed on a computer so that you can make use of get adforest get addomaincontroller cmdlets to query this information. As all domain controllers should end up in the domain controller ou in ad when you promote the server why not try.
Get your ad domain domainname get addomain dnsroot get all dc s alldcs get addomaincontroller filter server domainname select object hostname ipv4address isglobalcatalog site forest operatingsystem or alldcs get adforest globalcatalogs. It is necessary to specify the event log short name in the querylogs txt file. To collect the domain controller names from the active directory forest you can run dsquery server o rdn c temp dclist txt command.
This powershell script connects to each domain controller specified in the dclist txt file and then collects the name of the event log to query the destination domain controllers from the querylogs txt file. I have written a small function which can get this information for any forest as long as you have trust with computer from where you are running this code.