Give this a try.
Code:
Dim wshShell, wshNetwork
Dim strComputerName, objComputer
' Create Global Objects
Set wshNetwork = CreateObject("WScript.Network")
' Initialize Variables
strComputerName = wshNetwork.ComputerName
strDN = GetDN(strComputerName)
Set objComputer = GetObject("LDAP://" & strDN)
If Instr(objComputer.operatingSystem,"Server") Then
WScript.Echo "Server Found"
Else
WScript.Echo "Not A Server"
End If
Function GetDN(strComputerName)
' Use the NameTranslate object to convert the NT name of the computer to
' the Distinguished name required for the LDAP provider. Computer names
' must end with "$". Returns comma delimited string to calling code.
' Name translate thanks to Richard Meuller
Dim objTrans, objDomain
' Constants for the NameTranslate object.
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
Set objTrans = CreateObject("NameTranslate")
Set objDomain = getObject("LDAP://rootDse")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, wshNetwork.UserDomain & "\" _
& strComputerName & "$"
GetDN = objTrans.Get(ADS_NAME_TYPE_1779)
'Set DN to upper Case
GetDN = UCase(GetDN)
End Function