Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Domain account or local ?

Reply
Thread Tools Display Modes

Domain account or local ?

 
 
Vilius Mockūnas
Guest
Posts: n/a

 
      08-13-2009
Hi,

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

thanks
Vilius


 
Reply With Quote
 
 
 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      08-13-2009

"Vilius Mockūnas" <> wrote in message
news:...
> 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
--


 
Reply With Quote
 
Vilius Mockūnas
Guest
Posts: n/a

 
      08-13-2009
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-> wrote in
message news:...
>
> "Vilius Mockūnas" <> wrote in message
> news:...
>> 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
> --
>
>



 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      08-14-2009
You may need to test that in a workgroup situation.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
"Vilius Mockūnas" <> wrote in message
news:OVCH%...
> 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-> wrote in
> message news:...
>>
>> "Vilius Mockūnas" <> wrote in message
>> news:...
>>> 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
>> --
>>
>>

>
>



 
Reply With Quote
 
Vilius Mockūnas
Guest
Posts: n/a

 
      08-14-2009
As I remember userdomain property never returns workgroup name only
computer/domain.

V

"Richard Mueller [MVP]" <rlmueller-> wrote in
message news:...
> You may need to test that in a workgroup situation.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
> "Vilius Mockūnas" <> wrote in message
> news:OVCH%...
>> 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-> wrote in
>> message news:...
>>>
>>> "Vilius Mockūnas" <> wrote in message
>>> news:...
>>>> 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
>>> --
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Anthony Hollowell
Guest
Posts: n/a

 
      09-14-2009
is my domain name free for the year?
"Vilius Mockūnas" <> wrote in message
news:...
> Hi,
>
> How do I tell if account I'm running my script is domain account or local
> ?
> I'm using vbscript.
>
> thanks
> Vilius
>
>


 
Reply With Quote
 
asdf
Guest
Posts: n/a

 
      12-06-2009
Do not tsunami all groups with the same questions.

It is like doctors trying to operate all wounds at the same time after an
accident.

The body will refuse and cease to work.

---------------------

The body of knowledge is precious here.

There is less gold in the world than posters as you. ( I am not an native
English speaker)

----------------------------------------


As to your interpretable intend.

You must nowadays be an 'admin' to tell the distinction

whether you can detect / overwrite credentials.

*credentials = see groups history keyword






"Anthony Hollowell" <> wrote in message
news:uCg6$...
> is my domain name free for the year?
> "Vilius Mockūnas" <> wrote in message
> news:...
>> Hi,
>>
>> How do I tell if account I'm running my script is domain account or local
>> ?
>> I'm using vbscript.
>>
>> thanks
>> Vilius
>>
>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfering Settings from Domain Account to Local Account John Windows Vista Administration 0 06-14-2007 04:29 PM
RE: Restrict local administrative account to only local PC in a domain PhilScott-SBSAdmin Windows Small Business Server 1 02-08-2007 09:59 PM
Re: Possible? Convert local account to a domain account without losing my settings? Paul Bergson [MVP-DS] Active Directory 0 01-22-2007 12:03 AM
RE: Possible? Convert local account to a domain account without losing Sally Mathews Active Directory 0 01-21-2007 11:29 PM
VPN Problem with a domain account versus local computer account Daniel Windows Small Business Server 3 08-26-2005 07:34 AM



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 47 48 49 50 51 52 53 54 55 56 57 58 59