Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment variable or Registry key echoed in browser?

Status
Not open for further replies.

thespook

MIS
Apr 30, 2003
1
US
I'm trying to echo the computer name in a browser window/html document either from a registry key (HKLM\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName\ComputerName) or an environment variable (COMPUTERNAME). This will end up being part of the wallpaper of an active-desktop enabled PC and so the script will be running in the Intranet zone. I am very new to VB and VBScript and don't have a firm grasp of what is and is not allowed within a browser window. I have tried several bits of code and below are the last two that I've tried though neither actually echo any text in the browser. Any assistance would be greatly appreciated.

<Script Language=&quot;vbscript&quot;>
Dim WshSHell
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)
WScript.Echo WshShell.RegRead(&quot;HKLM\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName\ComputerName&quot;)
</Script>

<Script Language=&quot;vbscript&quot;>
Dim WshSHell
Set WshShell = Wscript.CreateObject(&quot;Wscript.Shell&quot;)
WScript.Echo WSHShell.Environment.item(&quot;computername&quot;)
</Script>


 
can u see the follwoing thread

are you sure you are asking for computername correctly? I dont know if you have to say COMPUTERNAME? because until now i found all environment items usually caled using capitals-i dont kow if that help-else try to get some other environment variable like PATH or WINDIR and see if it works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top