I just feel an UDF coming
This can also translate group names to DN
Just give a group name and don't add a $ at the end
; ===========================================================================================
;
;     Script Information
;    
;     Title: GetComputerDN
;     Author: Wim Rotty
;     Description: Get Distinguished Name of computer via NetBios name
;    
;
; ===========================================================================================
;Script Options

If Not @LOGONMODE
    Break On
Else
    Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
    $RC = SetOption("WrapAtEOL", "On")
EndIf

;Declare variables
Dim
$objSystemInfo

Dim $strDomain
Dim $objNetwork
Dim $strComputer
Dim $strComputerDN

;Initialize variables

;Code
;Get the NETBIOS name of the domain

$objSystemInfo
= CreateObject("ADSystemInfo")
$strDomain = $objSystemInfo.DomainShortName

; Get the name of the computer
$objNetwork = CreateObject("Wscript.Network")
$strComputer = $objNetwork.ComputerName

; Call function to return the distinguished name (DN) of the computer
$strComputerDN = getComputerDN($strComputer,$strDomain)

?
$strComputerDN

;Personal UDF Section

;UDF Section

Function
getComputerDN($strComputer,$strDomain)
   
   
; Constants required for name translate
    Dim $ADS_NAME_INITTYPE_GC
    Dim $ADS_NAME_TYPE_NT4
    Dim $ADS_NAME_TYPE_1779
    $ADS_NAME_INITTYPE_GC = 3
   
$ADS_NAME_TYPE_NT4 = 3
   
$ADS_NAME_TYPE_1779 = 1
   
   
; Function to get the distinguished name of a computer
    ; from the NETBIOS name of the computer (strcomputer)
    ; and the NETBIOS name of the domain (strDomain) using
    ; name translate

    Dim $objTrans
    $objTrans = CreateObject("NameTranslate")
   
; Initialize name translate using global catalog
    $objTrans.Init($ADS_NAME_INITTYPE_GC, "")
   
; Input computer name (NT Format)
    $objTrans.Set($ADS_NAME_TYPE_NT4, $strDomain + "\" + $strComputer + "$")
   
; Get Distinguished Name.
    $getComputerDN = $objTrans.Get($ADS_NAME_TYPE_1779)

EndFunction