Linux – Update DNS record on Windows Server as One-Liner

It is required, that the Linux machine already joined Active Dirctory!

echo -e "update delete $(hostname -f)\nupdate add $(hostname -f) 3600 A $(/sbin/ip a s|grep inet|head -1|awk '{print $2}'| cut -d '/' -f 1)\nsend\n" | nsupdate -g -v