I have tried to amend a previous batch file to select a local DC before running a specific task only relevant to that one as a number of DC’s on the Domain.
I dont get an output and wondering if someone can point me in the right direction please.
FOR /F "tokens=2 delims==" %%A IN ('nltest /dsgetdc: ^| FIND /I "DC: "') DO SET domain=%%A
ECHO Controller: "%domain%"
IF "%domain%"=="\DC01" GOTO :DC01
IF "%domain%"=="\DC02" GOTO :DC02
IF "%domain%"=="\DC03" GOTO :DC03
Did try @echo %logonserver% instead of nltest but again to no avail
New contributor
Rob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.