Discussion:
Domain account or local ?
(too old to reply)
Vilius Mockûnas
2009-08-13 21:24:12 UTC
Permalink
Hi,

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

thanks
Vilius
Richard Mueller [MVP]
2009-08-13 22:29:12 UTC
Permalink
Post by Vilius Mockûnas
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
--
Vilius Mockûnas
2009-08-13 23:27:03 UTC
Permalink
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
Post by Richard Mueller [MVP]
Post by Vilius Mockûnas
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
--
Richard Mueller [MVP]
2009-08-14 00:29:30 UTC
Permalink
You may need to test that in a workgroup situation.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Vilius Mockûnas
Hi,
Thanks for advice.
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
Post by Richard Mueller [MVP]
Post by Vilius Mockûnas
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
--
Vilius Mockûnas
2009-08-14 00:42:05 UTC
Permalink
As I remember userdomain property never returns workgroup name only
computer/domain.

V
Post by Richard Mueller [MVP]
You may need to test that in a workgroup situation.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Post by Vilius Mockûnas
Hi,
Thanks for advice.
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
Post by Richard Mueller [MVP]
Post by Vilius Mockûnas
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
--
Anthony Hollowell
2009-09-14 14:44:25 UTC
Permalink
is my domain name free for the year?
Post by Vilius Mockûnas
Hi,
How do I tell if account I'm running my script is domain account or local ?
I'm using vbscript.
thanks
Vilius
asdf
2009-12-06 09:07:48 UTC
Permalink
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
Post by Anthony Hollowell
is my domain name free for the year?
Post by Vilius Mockûnas
Hi,
How do I tell if account I'm running my script is domain account or local ?
I'm using vbscript.
thanks
Vilius
Loading...