Home All Groups Group Topic Archive Search About
Author
22 Sep 2005 5:21 PM
Diogenes Dilone
Folks,

How can I have the output come out on a text file.

Thanks
D



On Error Resume Next

Const ADS_SCOPE_SUBTREE = 2

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


objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objCommand.CommandText = _
    "SELECT AdsPath FROM 'LDAP://dc=lgihome,dc=com' WHERE
objectCategory='user'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
    Set objUser = GetObject(objRecordSet.Fields("AdsPath").Value)

    If objUser.AccountExpirationDate = "1/1/1970" Or Err.Number =
-2147467259 Then
        Wscript.Echo objUser.Name
    End If

    objRecordSet.MoveNext
Loop

Author
22 Sep 2005 5:35 PM
Steven Burn
Lookup the FileSystemObject

As an FYI, this should have been posted to;

microsoft.public.scripting.vbscript

.... and not the VB newsgroup ;o)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Show quoteHide quote
"Diogenes Dilone" <Diogenes Dil***@discussions.microsoft.com> wrote in
message news:A6A985E4-EFA1-4EC4-905D-E51224C1A7B9@microsoft.com...
> Folks,
>
> How can I have the output come out on a text file.
>
> Thanks
> D
>
>
>
> On Error Resume Next
>
> Const ADS_SCOPE_SUBTREE = 2
>
> Set objConnection = CreateObject("ADODB.Connection")
> Set objCommand =   CreateObject("ADODB.Command")
> objConnection.Provider = "ADsDSOObject"
> objConnection.Open "Active Directory Provider"
> Set objCommand.ActiveConnection = objConnection
>
>
> objCommand.Properties("Page Size") = 1000
> objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
>
> objCommand.CommandText = _
>     "SELECT AdsPath FROM 'LDAP://dc=lgihome,dc=com' WHERE
> objectCategory='user'"
> Set objRecordSet = objCommand.Execute
>
> objRecordSet.MoveFirst
> Do Until objRecordSet.EOF
>     Set objUser = GetObject(objRecordSet.Fields("AdsPath").Value)
>
>     If objUser.AccountExpirationDate = "1/1/1970" Or Err.Number =
> -2147467259 Then
>         Wscript.Echo objUser.Name
>     End If
>
>     objRecordSet.MoveNext
> Loop
>
>
>
Author
22 Sep 2005 5:40 PM
Matt Williamson
You need to use the FileSystemObject to write out data using vbscript. This
is the wrong group for that though.

Try these:

microsoft.public.scripting.wsh
microsoft.public.scripting.vbscript

HTH

Matt


Show quoteHide quote
"Diogenes Dilone" <Diogenes Dil***@discussions.microsoft.com> wrote in
message news:A6A985E4-EFA1-4EC4-905D-E51224C1A7B9@microsoft.com...
> Folks,
>
> How can I have the output come out on a text file.
>
> Thanks
> D
>
>
>
> On Error Resume Next
>
> Const ADS_SCOPE_SUBTREE = 2
>
> Set objConnection = CreateObject("ADODB.Connection")
> Set objCommand =   CreateObject("ADODB.Command")
> objConnection.Provider = "ADsDSOObject"
> objConnection.Open "Active Directory Provider"
> Set objCommand.ActiveConnection = objConnection
>
>
> objCommand.Properties("Page Size") = 1000
> objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
>
> objCommand.CommandText = _
>    "SELECT AdsPath FROM 'LDAP://dc=lgihome,dc=com' WHERE
> objectCategory='user'"
> Set objRecordSet = objCommand.Execute
>
> objRecordSet.MoveFirst
> Do Until objRecordSet.EOF
>    Set objUser = GetObject(objRecordSet.Fields("AdsPath").Value)
>
>    If objUser.AccountExpirationDate = "1/1/1970" Or Err.Number =
> -2147467259 Then
>        Wscript.Echo objUser.Name
>    End If
>
>    objRecordSet.MoveNext
> Loop
>
>
>