Hi folks,

I'd like to access the user, computer and domain by
VBScript. Someone gave me the following scripts:

<!-- The Name of the File may be UserInfo.html -->
<HTML>
<HEAD> <TITLE>Getting User Information. </TITLE>
<Script Language="VBScript">
Dim objNet
On Error Resume Next 'In case we fail to create
object then display our custom error
Set objNet = CreateObject("WScript.NetWork")
If Err.Number <> 0
Then 'If error occured then display
notice
MsgBox "Don't be Shy." & vbCRLF & "Do not
press ""No"" If your browser warns you."
'Document.Location = "UserInfo.html"
'Place the Name of the document.
'It
will display again
End if

Dim strInfo
strInfo = "User Name is " & objNet.UserName &
vbCRLF & _
"Computer Name is " &
objNet.ComputerName & vbCRLF & _
"Domain Name is " & objNet.UserDomain
MsgBox strInfo

Set objNet =
Nothing 'Destroy the Object to free
the Memory

MsgBox "VB script final."
</Script>
</HEAD>
<BODY>
<H1 align="center">Did You got Information ???? </H1>
</Body>
</HTML>

It works well if I put this html in local file system.
However, once I put this html to web server or ap server,
it will show error and doesn't work.

Is there any other solutions? Your kindly support is very
appreciated.

Regards,
Sidney

Re: Get User, Computer and Domain Name via VBScript by Michael

Michael
Thu Oct 23 22:29:32 CDT 2003

> I'd like to access the user, computer and domain by
> VBScript. Someone gave me the following scripts:


Which won't work in IE due to security issues...

If you use authenticated access rather that anonymous, the you can get

Request.ServerVariables("AUTH_USER")

which is a string in "domainname\username" format.

Getting the client machine name isn't practical, especially where client IPs
are assigned via DHCP.


--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en


Re: Get User, Computer and Domain Name via VBScript by Sidney

Sidney
Fri Oct 24 07:13:25 CDT 2003

Hi Michael,

Thanks for replying. I don't understand what authenticated=20
access is and how to do it. Would kindly you provide some=20
hints?

Regards,
Sidney

>-----Original Message-----
>
>Which won't work in IE due to security issues...
>
>If you use authenticated access rather that anonymous,=20
the you can get
>
>Request.ServerVariables("AUTH_USER")
>
>which is a string in "domainname\username" format.
>
>Getting the client machine name isn't practical,=20
especially where client IPs
>are assigned via DHCP.
>
>
>--=20
>Michael Harris
>Microsoft.MVP.Scripting
>
>Windows 2000 Scripting Guide
>Microsoft=AE Windows=AE2000 Scripting Guide
>http://www.microsoft.com/technet/scriptcenter/scrguide/sag
sas_overview.asp
>
>TechNet Script Center Sample Scripts
>http://www.microsoft.com/downloads/release.asp?
ReleaseID=3D38942
>
>WSH 5.6 documentation download
>http://www.microsoft.com/downloads/details.aspx?
FamilyId=3D01592C48-207D-4BE1-8A76-
1C4099D7BBB9&displaylang=3Den
>
>.
>

Re: Get User, Computer and Domain Name via VBScript by Michael

Michael
Fri Oct 24 15:30:20 CDT 2003

Sidney wrote:
> Hi Michael,
>
> Thanks for replying. I don't understand what authenticated
> access is and how to do it. Would kindly you provide some
> hints?


Microsoft Windows 2000 Server Documentation
Enabling and Configuring Authentication
http://www.microsoft.com/windows2000/en/server/iis/htm/core/iiauths.htm?id=76

Note: Also applies to IIS running on Windows 2000 Professional.

--
Michael Harris
Microsoft.MVP.Scripting

Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en