I am trying to write a batch script to find the domain controller hostname.
Based from the following article
nslookup
set type=all
_ldap._tcp.dc._msdcs.domain.name
What I would like to try and get working is at the start it prompts you for the domain name and then you enter it and it calls later on and replaces domain.name in the third line.
The idea is that I can hop onto one of my clients machines run the script and find exactly where the DC is for things like password resets
So far I have the following but it crashes instantly after entering the domain name
@echo off
set /p domain="Enter domain name: "
nslookup
set type=all
_ldap._tcp.dc._msdcs.%domain%
pause