Dumping logon name and logon script values to a text file - blank logon script field



A while back someone here was kind enough to provide me with the following
script and advice on how to dump these two values to a text file. It worked
great except for one thing. If the user had no logon script, they were
ignored by the script and didn't appear at all in the output. I am hoping
someone can tell me what I'd need to modify in the script below to dump a
list of the AD users with blank Logon Script values.

Thanks!



"Option Explicit

Dim adoCommand, adoConnection, strBase, strFilter, strAttributes

Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strName, strScript



' Setup ADO objects.

Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection



' Search entire Active Directory domain.

Set objRootDSE = GetObject("LDAP://RootDSE";)

strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://"; & strDNSDomain & ">"


' Filter on user objects.
strFilter = "(&(objectCategory=person)(objectClass=user))"



' Comma delimited list of attribute values to retrieve.
strAttributes = "sAMAccountName,scriptPath"



' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False



' Run the query.
Set adoRecordset = adoCommand.Execute


' Enumerate the resulting recordset.
Do Until adoRecordset.EOF

' Retrieve values and display.
strName = adoRecordset.Fields("sAMAccountName").Value

strScript = adoRecordset.Fields("scriptPath").value

Wscript.Echo strName & "," & strScript

' Move to the next record in the recordset.
adoRecordset.MoveNext
Loop



' Clean up.

adoRecordset.Close

adoConnection.Close

===========


.



Relevant Pages

  • Re: ADSI Script to return all Active Directory users with Dialin-E
    ... Dim adoCommand, adoConnection, strBase, strFilter, strAttributes ... Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strDN ... ' Move to the next record in the recordset. ... The script should be run at a command prompt with the cscript host. ...
    (microsoft.public.scripting.vbscript)
  • [Summary] puzzle with cold mirror script
    ... puzzle with cold mirror script ... DUMP: Date of last level 0 dump: the epoch ... all the disk information and a listing of the script follows. ... /export/home/chris# format ...
    (SunManagers)
  • Re: different ip addresses at different locations
    ... > Neither locations have a DHCP in existence. ... script you write for them to change the IP appropriately. ... Do a GOOGLE search for NETSH for more information, ... netsh -c interface dump>settingssiteone.txt ...
    (microsoft.public.windowsxp.work_remotely)
  • Re: Wikipedia - conversion of in SQL database stored data to HTML
    ... is a Perl script to convert a Wikipedia SQL dump ... size of the SQL dump. ... >> I loaded all of the Wikipedia data into a local MySQL server a while ...
    (comp.lang.python)
  • Re: Need some small help on shell script - delete old files
    ... I am using your script. ... recent dump is always left un-compressed with no .gz extension. ... or use the "wait" command to see if it must delay the start of the ... The second dump has to be coming from an alternate CRON job or an AT ...
    (comp.unix.shell)