Re: VBSCRIPT to get USERNAME / LOGIN
- From: "jfuhrman3@xxxxxxx" <jfuhrman3@xxxxxxx>
- Date: 23 Feb 2007 09:18:01 -0800
On Feb 22, 10:15 am, "colo" <mario.color...@xxxxxxxxx> wrote:
Hi!
I am new to VBSCRIPT and can't find a way to get the username of the
person looking at the webpage. I'm working inside the intranet, so
everyone is already logged in. From an ASP page I am sending a email
when the user clicks on submit... what I need to do is include the
username (login name) of the person sending the form. How can I do
this?
Thanks a lot for your help!!!
This may help you out since you say this is on your Intranet.
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
'Automatically find the domain name
Set objDomain = getObject("LDAP://rootDse")
DomainString = objDomain.Get("dnsHostName")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
'Grab the user name
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check
'for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'Grab the computer name for use in add-on code later
strComputer = WSHNetwork.ComputerName
Hope this helps
John Fuhrman
.
- References:
- VBSCRIPT to get USERNAME / LOGIN
- From: colo
- VBSCRIPT to get USERNAME / LOGIN
- Prev by Date: Re: Creating a directory structure
- Next by Date: Re: Creating a directory structure
- Previous by thread: VBSCRIPT to get USERNAME / LOGIN
- Next by thread: Re: VBSCRIPT to get USERNAME / LOGIN
- Index(es):
Relevant Pages
|