Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Domain account or local ?

Reply
 
Old 08-13-2009   #1 (permalink)
Vilius Mockûnas


 
 

Domain account or local ?

Hi,

How do I tell if account I'm running my script is domain account or local ?
I'm using vbscript.

thanks
Vilius



My System SpecsSystem Spec
Old 08-13-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Domain account or local ?


"Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
news:e2osUxFHKHA.1248@xxxxxx
Quote:

> Hi,
>
> How do I tell if account I'm running my script is domain account or local
> ?
> I'm using vbscript.
>
> thanks
> Vilius
>
I code similar to the following:
=======
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
If (Err.Number = 0) Then
strUserDN = objSysInfo.UserName
If (Err.Number = 0) Then
On Error GoTo 0
blnDomain = True
Else
On Error GoTo 0
blnDomain = False
End If
Else
On Error GoTo 0
blnDomain = False
End If
========
If blnDomain is True, the user is authenticated to AD. There may be other
ways, but I chose this method because it times quickly if the user is not
authenticated to a domain. I'd be interested to know if anyone has other
methods.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 08-13-2009   #3 (permalink)
Vilius Mockûnas


 
 

Re: Domain account or local ?

Hi,

Thanks for advice.
But I found simpler way:
dim o_wsh_network
set o_wsh_network = createobject( "WScript.Network" )
if o_wsh_network.userdomain = o_wsh_network.computername then
msgbox( "local account" )
else
msgbox( "domain account" )
endif

V

"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:e6I19VGHKHA.4620@xxxxxx
Quote:

>
> "Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
> news:e2osUxFHKHA.1248@xxxxxx
Quote:

>> Hi,
>>
>> How do I tell if account I'm running my script is domain account or local
>> ?
>> I'm using vbscript.
>>
>> thanks
>> Vilius
>>
>
> I code similar to the following:
> =======
> On Error Resume Next
> Set objSysInfo = CreateObject("ADSystemInfo")
> If (Err.Number = 0) Then
> strUserDN = objSysInfo.UserName
> If (Err.Number = 0) Then
> On Error GoTo 0
> blnDomain = True
> Else
> On Error GoTo 0
> blnDomain = False
> End If
> Else
> On Error GoTo 0
> blnDomain = False
> End If
> ========
> If blnDomain is True, the user is authenticated to AD. There may be other
> ways, but I chose this method because it times quickly if the user is not
> authenticated to a domain. I'd be interested to know if anyone has other
> methods.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>

My System SpecsSystem Spec
Old 08-13-2009   #4 (permalink)
Richard Mueller [MVP]


 
 

Re: Domain account or local ?

You may need to test that in a workgroup situation.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
"Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
news:OVCH%231GHKHA.1380@xxxxxx
Quote:

> Hi,
>
> Thanks for advice.
> But I found simpler way:
> dim o_wsh_network
> set o_wsh_network = createobject( "WScript.Network" )
> if o_wsh_network.userdomain = o_wsh_network.computername then
> msgbox( "local account" )
> else
> msgbox( "domain account" )
> endif
>
> V
>
> "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
> message news:e6I19VGHKHA.4620@xxxxxx
Quote:

>>
>> "Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
>> news:e2osUxFHKHA.1248@xxxxxx
Quote:

>>> Hi,
>>>
>>> How do I tell if account I'm running my script is domain account or
>>> local ?
>>> I'm using vbscript.
>>>
>>> thanks
>>> Vilius
>>>
>>
>> I code similar to the following:
>> =======
>> On Error Resume Next
>> Set objSysInfo = CreateObject("ADSystemInfo")
>> If (Err.Number = 0) Then
>> strUserDN = objSysInfo.UserName
>> If (Err.Number = 0) Then
>> On Error GoTo 0
>> blnDomain = True
>> Else
>> On Error GoTo 0
>> blnDomain = False
>> End If
>> Else
>> On Error GoTo 0
>> blnDomain = False
>> End If
>> ========
>> If blnDomain is True, the user is authenticated to AD. There may be other
>> ways, but I chose this method because it times quickly if the user is not
>> authenticated to a domain. I'd be interested to know if anyone has other
>> methods.
>>
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>
>

My System SpecsSystem Spec
Old 08-13-2009   #5 (permalink)
Vilius Mockûnas


 
 

Re: Domain account or local ?

As I remember userdomain property never returns workgroup name only
computer/domain.

V

"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:e9tKMZHHKHA.4432@xxxxxx
Quote:

> You may need to test that in a workgroup situation.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
> "Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
> news:OVCH%231GHKHA.1380@xxxxxx
Quote:

>> Hi,
>>
>> Thanks for advice.
>> But I found simpler way:
>> dim o_wsh_network
>> set o_wsh_network = createobject( "WScript.Network" )
>> if o_wsh_network.userdomain = o_wsh_network.computername then
>> msgbox( "local account" )
>> else
>> msgbox( "domain account" )
>> endif
>>
>> V
>>
>> "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
>> message news:e6I19VGHKHA.4620@xxxxxx
Quote:

>>>
>>> "Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
>>> news:e2osUxFHKHA.1248@xxxxxx
>>>> Hi,
>>>>
>>>> How do I tell if account I'm running my script is domain account or
>>>> local ?
>>>> I'm using vbscript.
>>>>
>>>> thanks
>>>> Vilius
>>>>
>>>
>>> I code similar to the following:
>>> =======
>>> On Error Resume Next
>>> Set objSysInfo = CreateObject("ADSystemInfo")
>>> If (Err.Number = 0) Then
>>> strUserDN = objSysInfo.UserName
>>> If (Err.Number = 0) Then
>>> On Error GoTo 0
>>> blnDomain = True
>>> Else
>>> On Error GoTo 0
>>> blnDomain = False
>>> End If
>>> Else
>>> On Error GoTo 0
>>> blnDomain = False
>>> End If
>>> ========
>>> If blnDomain is True, the user is authenticated to AD. There may be
>>> other ways, but I chose this method because it times quickly if the user
>>> is not authenticated to a domain. I'd be interested to know if anyone
>>> has other methods.
>>>
>>> --
>>> Richard Mueller
>>> MVP Directory Services
>>> Hilltop Lab - http://www.rlmueller.net
>>> --
>>>
>>>
>>
>>
>
>

My System SpecsSystem Spec
Old 09-14-2009   #6 (permalink)
Anthony Hollowell


 
 

Re: Domain account or local ?

is my domain name free for the year?
"Vilius Mockûnas" <v_mockunas@newsgroup> wrote in message
news:e2osUxFHKHA.1248@newsgroup
Quote:

> Hi,
>
> How do I tell if account I'm running my script is domain account or local
> ?
> I'm using vbscript.
>
> thanks
> Vilius
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
domain user account UAC without domain admin id/password?? Vista security
Need to change external domain without changing the .local domain Virtual Server
Local Vista User Account using Domain Security Pol? Vista security
Can't access local .chm files from directories created from my domain account Vista General
Transfering Settings from Domain Account to Local Account Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46