469,927 Members | 1,867 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Display username and hostname on Intranet

I would like to display the hostname (or computername) and username (or
logonID) on our Intranet support page. I saved the following vbs code as asp
file, but it doesn't display the username. No error also. Do I miss some
thing?

dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
Wscript.Echo "User " & objNetwork.UserName

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on
http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.
Jul 19 '05 #1
6 11277
Were the solutions in the .vbscript not working for you?

Ray at work

"Bob Lin" <no*****@hotmail.com> wrote in message
news:OX**************@TK2MSFTNGP09.phx.gbl...
I would like to display the hostname (or computername) and username (or
logonID) on our Intranet support page. I saved the following vbs code as asp file, but it doesn't display the username. No error also. Do I miss some
thing?

dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
Wscript.Echo "User " & objNetwork.UserName

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on
http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.

Jul 19 '05 #2
Hi Ray,

Thank you for all help. I added servervariables like remote_host, auth_user.
the remote_host display ip and auth_user display nothing even we have
internal DNS and IIS logging is enabled. I also read an article from MS, I
need to work on the intranet and it may increase the traffic. I haven't try
it.

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on
http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Were the solutions in the .vbscript not working for you?

Ray at work

"Bob Lin" <no*****@hotmail.com> wrote in message
news:OX**************@TK2MSFTNGP09.phx.gbl...
I would like to display the hostname (or computername) and username (or
logonID) on our Intranet support page. I saved the following vbs code as

asp
file, but it doesn't display the username. No error also. Do I miss some thing?

dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
Wscript.Echo "User " & objNetwork.UserName

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.


Jul 19 '05 #3
For AUTH_USER, you have to turn off anonymous access for your site,
directory, or page that you want the AUTH_USER from. See here.
http://www.aspfaq.com/show.asp?id=2046

Ray at work

"Bob Lin" <no*****@hotmail.com> wrote in message
news:uj**************@TK2MSFTNGP11.phx.gbl...
Hi Ray,

Thank you for all help. I added servervariables like remote_host, auth_user. the remote_host display ip and auth_user display nothing even we have
internal DNS and IIS logging is enabled. I also read an article from MS, I need to work on the intranet and it may increase the traffic. I haven't try it.

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on
http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Were the solutions in the .vbscript not working for you?

Ray at work

"Bob Lin" <no*****@hotmail.com> wrote in message
news:OX**************@TK2MSFTNGP09.phx.gbl...
I would like to display the hostname (or computername) and username (or logonID) on our Intranet support page. I saved the following vbs code
as
asp
file, but it doesn't display the username. No error also. Do I miss

some thing?

dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
Wscript.Echo "User " & objNetwork.UserName

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.



Jul 19 '05 #4
On Tue, 28 Oct 2003 08:37:27 -0600, "Bob Lin" <no*****@hotmail.com>
wrote:
I would like to display the hostname (or computername) and username (or
logonID) on our Intranet support page. I saved the following vbs code as asp
file, but it doesn't display the username. No error also. Do I miss some
thing?

dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
Wscript.Echo "User " & objNetwork.UserName


Well, you missed that this isn't VBScript... :)

This is WSH, and won't work in a web page as you intend. There are a
few ways around this. If you're using Windows authentication in your
intranet site (not just anonymous access) you can use the server
variables. Something like:

User = Request.ServerVariables("Logon_User")
Response.Write User

Alternatively, you can capture WshNetwork properties such as
UserDomain and UserName in a login script, then save them to a text
file, database or whatever. We do a bit of both, capturing
information in a logon script to a database and using it from intranet
pages as needed.

Jeff
Jul 19 '05 #5
Hi Jeff,

Thank you. Will try this and let you know.

--
For more and other information, go to http://www.ChicagoTech.net

Don't send e-mail or reply to me except you need consulting services.
Posting on MS newsgroup will benefit all readers and you may get more help.

Robert Lin, MS-MVP, MCSE & CNE
Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on
http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.

"Jeff Cochran" <jc*************@naplesgov.com> wrote in message
news:3f*****************@msnews.microsoft.com...
On Tue, 28 Oct 2003 08:37:27 -0600, "Bob Lin" <no*****@hotmail.com>
wrote:
I would like to display the hostname (or computername) and username (or
logonID) on our Intranet support page. I saved the following vbs code as aspfile, but it doesn't display the username. No error also. Do I miss some
thing?

dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
Wscript.Echo "User " & objNetwork.UserName


Well, you missed that this isn't VBScript... :)

This is WSH, and won't work in a web page as you intend. There are a
few ways around this. If you're using Windows authentication in your
intranet site (not just anonymous access) you can use the server
variables. Something like:

User = Request.ServerVariables("Logon_User")
Response.Write User

Alternatively, you can capture WshNetwork properties such as
UserDomain and UserName in a login script, then save them to a text
file, database or whatever. We do a bit of both, capturing
information in a logon script to a database and using it from intranet
pages as needed.

Jeff

Jul 19 '05 #6
Hi Ray,

Thank you again. Will try this and let you know.
..

Robert Lin, MS-MVP, MCSE & CNE
Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on
http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
For AUTH_USER, you have to turn off anonymous access for your site,
directory, or page that you want the AUTH_USER from. See here.
http://www.aspfaq.com/show.asp?id=2046

Ray at work

"Bob Lin" <no*****@hotmail.com> wrote in message
news:uj**************@TK2MSFTNGP11.phx.gbl...
Hi Ray,

Thank you for all help. I added servervariables like remote_host, auth_user.
the remote_host display ip and auth_user display nothing even we have
internal DNS and IIS logging is enabled. I also read an article from MS, I
need to work on the intranet and it may increase the traffic. I haven't try
it.

Networking, Internet, Routing, VPN, Anti-Virus, Tips & Troubleshooting on http://www.ChicagoTech.net
This posting is provided "AS IS" with no warranties.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Were the solutions in the .vbscript not working for you?

Ray at work

"Bob Lin" <no*****@hotmail.com> wrote in message
news:OX**************@TK2MSFTNGP09.phx.gbl...
> I would like to display the hostname (or computername) and username (or > logonID) on our Intranet support page. I saved the following vbs
code as asp
> file, but it doesn't display the username. No error also. Do I miss

some
> thing?
>
> dim objNetwork
> Set objNetwork = WScript.CreateObject("WScript.Network")
> strUserDomain = objNetwork.UserDomain
> Wscript.Echo "User " & objNetwork.UserName
>
> Networking, Internet, Routing, VPN, Anti-Virus, Tips &

Troubleshooting on
> http://www.ChicagoTech.net
> This posting is provided "AS IS" with no warranties.
>
>



Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Brent Burkart | last post: by
6 posts views Thread by John Dalberg | last post: by
8 posts views Thread by Bruno Barros | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.