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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help Please!!

Status
Not open for further replies.

Demtro

MIS
Jul 10, 2002
15
US
First off I hope this Is posted in the right section. I have been givin the task of creating batch file or text file that when it is run it extracts the computer name from the registry and places it into an HTML page that the script creates. This is so we can have an ACtive Desktop item running that shows the computer name. Can somebody help me or point me in the proper direction thanks.
 
A much easier way to get the computer name is to run "hostname" from a DOS prompt, but getting that written into an HTML file could be somewhat tricky. A possible workaround is to have the batch file run the hostname command and leave it on the desktop, but this wont work if users are working at the same time (Somebody will close it, guaranteed).

A+, MCP
 
Hi,
why do you want to read the computername from the registry? You can simply use the %computername% variable.
I think your main problem is to use the variable in your HTML page. For that create a template HTML and on the place where where your computername should be shown use a unique name. A simple HTML:
<html>
<body>
<p> Computername: MYCOMPNAME </p>
</body>
</html>
In this example i used &quot;MYCOMPNAME&quot; as the unique name.
Now you can use a tool that exchanges the unique name with the variable %computername%. For this action i use the tool SED, which you can find it here: enter &quot;SED &quot;s/MYCOMPNAME/%computername%/&quot;< c:\winnt\template.htm >c:\winnt\output.htm&quot;
the Tool now creates a output.htm in your winnt directory and exchange the MYCOMPNAME with your computername (the unique name is case sensitive).

Other ways to do this task is to use a script language in your html or you can use the tool BGInfo. BGInfo doesn't create a HTML-File it writes a new background BMP from the current background and ads the computername to the Picture (and many other infos if you want). Take a look at this great tool, you find this (and many other great tools) under .

Hope this helps
 
Thank you all for the information. It is not exactly what I am looking for. It is possible in my rambles i was not specific enough. This is the situation in a nut shell.

We run a 200 station windows 2000 network in my office. We want to use Active Desktop on the computers to Display the computer name of the computer. We can very easily create a file with the current computer name however if the names change we have to change the file. So what we want to do is create a script that runs at login and it generates the HTML page and places the current computer name in the HTML page. This way when we use a group policy to staticly set the page it has the computer name in it. And if the computer name changes we do not have to worry about editing the file. The script deletes the existing file if it exists and creates a new one with the current computer name in it. I hope this is more clear. From what i hear it needs to be a VB Script if you need any other info let me know please.

Kevin King
kking1@tampabay.rr.com
 
If all you need is the computer name You can change My Computer to display the computer name by the following:
1. Use Regedt32 to navigate to:

HKEY_CLASSES_ROOT\CLSID\{20D04FE0......

2. Select the <Default> value in the right hand pane and delete it
(It should have contained the current caption).

3. On the Edit menu, click Add Value.

4. Leave the Value Name blank and Select Data Type of REG_EXPAND_SZ

5. In the String box, type any one of the following lines (or make your own).

%UserName% %ComputerName%
User: %UserName% on: %ComputerName%

6. Refresh the screen or logoff/logon.

If you want to put it in a batch file try:
echo y| reg delete HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\=&quot;My Computer&quot;
reg add HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\=&quot;%&quot;computername&quot;% /%&quot;username&quot;%&quot; REG_EXPAND_SZ

The echo y| pipes your confirmation of the delete. The interior quote marks around computername and username prevents their immediate expansion.
Modify to fit your needs
 
Hi,
you can use the SED-Tool in your loginscript to create a html-background every time a user logs on. You can do the same with BGInfo.
Or you can use a html-file with VBScript to get the computername dynamically. Here's a sample:

<html>
<p>Your Computername:</p>

<SCRIPT language=VBscript>
Option Explicit
Dim oNetwork
Dim Hostname
Set oNetwork = CreateObject(&quot;wscript.network&quot;)
hostname = oNetwork.ComputerName
document.writeln(Hostname)
</Script>

</html>


Jens
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top