Detecting a user's domain

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

Detecting a user's domain

Post by IanSmith » Tue Aug 09, 2005 9:20 am

Hello all,

A question; I need to determine a user's domain through a script. I'm scoobied. If anyone knows of some bizarre undocumented command that would provide this information, I'd be delerious with joy and gratitude...

Thanks, Ian

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Aug 09, 2005 9:57 am

This gets the current user's domain name. Not sure if that's what you really want though:

VBSTART
Set WSNet = CreateObject( "WScript.Network" )
sUsername = WSNet.UserName
sUserdomain = WSNet.UserDomain
VBEND
VBEVal>sUserdomain,domain
VBEval>sUsername,username
MJT Net Support
[email protected]

IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

Post by IanSmith » Tue Aug 09, 2005 10:12 am

That is _exactly_ what I wanted :)

Eye thangoo,

Ian

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts