Windows Vista Forums

Domain account or local ?
  1. #1


    Vilius Mockûnas Guest

    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

  2. #2


    Richard Mueller [MVP] Guest

    Re: Domain account or local ?


    "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

  3. #3


    Vilius Mockûnas Guest

    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

    >
    > "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

  4. #4


    Richard Mueller [MVP] Guest

    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

    > 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

    >>
    >> "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

  5. #5


    Vilius Mockûnas Guest

    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

    > 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

    >> 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

    >>>
    >>> "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

  6. #6


    Anthony Hollowell Guest

    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

    > 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

Domain account or local ?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows cannot bind to XXXXXXXXXXXX.local domain. (Local Error). G Jason Boull, MCP SBS Server 5 27 Jan 2010
domain account user vs local account user in vista pbodavula System Security 1 23 Oct 2009
Local Vista User Account using Domain Security Pol? Noob Vista security 4 01 Apr 2008
Can't access local .chm files from directories created from my domain account Tom Chm Vista General 1 30 Nov 2007
Transfering Settings from Domain Account to Local Account John Vista account administration 0 14 Jun 2007