VBS to find FQDN of a computer

Below script help you to find the FQDN of a computer!!

On Error Resume Next

StrRegKeyCompName = “HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\”
StrRegKeyTCPIP = “HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\”

Set WSHShell = CreateObject(“WScript.Shell”)

StrHostname = WSHShell.RegRead (StrRegKeyTCPIP & “Hostname”)
StrDomainName = WSHShell.RegRead (StrRegKeyTCPIP & “Domain”)
StrFQDN = StrHostName & “.” & StrDomainName
msgbox StrFQDN


2 Responses to “VBS to find FQDN of a computer”

  1. 1 S.E. March 23, 2011 at 1:53 pm

    This is exactly what I was looking for. Thanks from the future… 🙂

  2. 2 Sam October 1, 2012 at 6:07 pm

    I tried this ,it is not working

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: