What I am trying to do is to save the output of a powershell command (run from a batch script) and use it in the batch script.
Can you please advise me what to do?
You can do this in batch using nslookup which does the same DNS-search:
nslookup
for /f "tokens=1*" %%a in ('nslookup hostname ^| findstr /i "name"') do set return=%%b echo Hello '%return%'