Re: WScript from ASP

by "K J Evans" <kje(at)vendetta.co.uk>

 Date:  Sun, 30 Dec 2001 13:45:32 -0000
 To:  "Sauer,
Michael F." <SauerM(at)missouri.edu>,
<hwg-servers(at)hwg.org>
 References:  missouri
  todo: View Thread, Original
Try this--Remember it runs locally on the server so it will give you the web
server's netbios name not the client's.

I've used &lt; and &gt; in case the list server gets confused

&lt;%@ language="vbscript" %&gt;
&lt;%
Option explicit
Response.buffer=true
Response.expires=-1440
%&gt;
&lt;%
Dim WSHShell
Dim CompName

Set WSHShell = CreateObject("WScript.Shell")
 CompName = WSHShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

 Response.Write "The computer name is " & CompName
%&gt;

Kathy Evans
Vendetta Business & Technical Services Limited
http://www.vendetta.co.uk
0191 421 1532
07770 538739

----- Original Message -----
From: "Sauer, Michael F." <SauerM(at)missouri.edu>
To: <hwg-servers(at)hwg.org>
Sent: Friday, December 28, 2001 4:34 PM
Subject: WScript from ASP


> I am trying to access some environment variables
> from an asp script.
>
> Looking online I foune may examples like
>
> Dim Shell
> Dim CompName
>
> Set Shell = WScript.CreateObject("WScript.Shell")
> CompName = Shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
>
> Msgbox "The computer name is " & CompName
>
> ============================================
>
> when I connect to the page I get
>
> Error Type:
> Microsoft VBScript runtime (0x800A01A8)
> Object required: ''
> /Groups/mit/env-test.asp, line 14
>
> ============================================
>
> where line 14 is; Set Shell = WScript.CreateObject("WScript.Shell")
>
> The browser is MSIE 5.5.
> The web server is IIS 5 running on either Win 2000 Server or
> Win 2000 Advanced Server and my system guy tells me WSH is
> installed on the system.
>
> What piece of this puzzle am I missing?
>
> thanks
>
> Mike
>
> Micahel Sauer
> Univ. of Missouri
> Research Reactor
> (573) 882-5327
> sauerm(at)missouri.edu
>

HWG: hwg-servers mailing list archives, maintained by Webmasters @ IWA