Hi All,
I am new to the VB world. I am writing my first script to fetch data from registry. OS is Windows 7.
Option Explicit
On Error Resume Next
Dim objshell
Dim regactivecomputername,regcomputername,reghostname
Dim activecomputername,computername,hostname
regactivcomputername = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerNam e"
regcomputername = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"
reghostname = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\HostName"
Set objshell = CreateObject(WScript.Shell)
activecomputername= objshell.ReadReg(regactivcomputername)
computername= objshell.ReadReg(computername)
hostname= objshell.ReadReg(hostname)
WScript.Echo activecomputername &"is active computer name"
WScript.Echo computername &"is computer name"
WScript.Echo hostname &"is host name"[/B]But system not fecthing data from refgistry. It only shows is active computer name Etc.
Is there anything needs to be installed for windows 7 or how to go about this.
Please help.
I am new to the VB world. I am writing my first script to fetch data from registry. OS is Windows 7.
Option Explicit
On Error Resume Next
Dim objshell
Dim regactivecomputername,regcomputername,reghostname
Dim activecomputername,computername,hostname
regactivcomputername = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerNam e"
regcomputername = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"
reghostname = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\HostName"
Set objshell = CreateObject(WScript.Shell)
activecomputername= objshell.ReadReg(regactivcomputername)
computername= objshell.ReadReg(computername)
hostname= objshell.ReadReg(hostname)
WScript.Echo activecomputername &"is active computer name"
WScript.Echo computername &"is computer name"
WScript.Echo hostname &"is host name"[/B]But system not fecthing data from refgistry. It only shows is active computer name Etc.
Is there anything needs to be installed for windows 7 or how to go about this.
Please help.