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