![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 > ======= 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| | #5 (permalink) |
| | 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 Specs![]() |
| | #6 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||