Passing username to logon script

P

Phil Teale

Hi,

I am in the process of writing a logon script that will set up shares
and home directories according to the groups the user belongs to.

I have written an ADSI to query their AD record and the resultant
string is searched to see if it contains "IT", "Marketing", "Sales"
etc. This works fine when the username is passed as a command line
argument, but I would like the script to accept their logon name
directly.

%username% doesn't appear to work inside VBS, and I have tried the
following

Set objNet = WScript.CreateObject("WScript.Network")
strUsrName = objNet.UserName

this returns "JBloggs", but the AD entry is "Joe Bloggs", so there is
no match.

My Question is this: Is there an object property that contains the
logon name "JBloggs" and the AD object name "Joe Bloggs"? This would
let me pass the full name to the logon script and all would be fine
and dandy.

TIA

Phil Teale
 
J

Jack Seredyniecki

Dim strUserName
Set WSHNetwork = CreateObject("WScript.Network")
strUserName = WSHNetwork.UserName
WScript.Echo (strUsername)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top