Home All Groups Group Topic Archive Search About

CSVDE Multiple group export..



Author
10 Oct 2007 10:11 AM
PK
Dear all

I got the below to work ok, ( I can also export the entire OU)

csvde -f C:\Get-Group\GroupMembers.csv -r
"memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
"sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
-SERVER.DOM.co.uk

But i need to export all members of just 4 groups (from the same OU) Not
just H050 ie i need to include H051 H052 H053 also..

Any options \ideas.

Kr
Paul

Author
10 Oct 2007 4:10 PM
Richard Mueller [MVP]
Paul wrote:

> I got the below to work ok, ( I can also export the entire OU)
>
> csvde -f C:\Get-Group\GroupMembers.csv -r
> "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
> "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> -SERVER.DOM.co.uk
>
> But i need to export all members of just 4 groups (from the same OU) Not
> just H050 ie i need to include H051 H052 H053 also..
>
> Any options \ideas.
>

The syntax for the filter would be (watch line wrapping):

-r
"(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"

Wildcards are not allowed and you must specify the full distinguished names.
The "|" (pipe symbol) is the "OR" operator.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
10 Oct 2007 4:22 PM
PK
Rich can this be built in to VB some how..?

with like a window to promps for group numbers..?

other than that works a charm

Show quote
"Richard Mueller [MVP]" wrote:

> Paul wrote:
>
> > I got the below to work ok, ( I can also export the entire OU)
> >
> > csvde -f C:\Get-Group\GroupMembers.csv -r
> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> > -SERVER.DOM.co.uk
> >
> > But i need to export all members of just 4 groups (from the same OU) Not
> > just H050 ie i need to include H051 H052 H053 also..
> >
> > Any options \ideas.
> >
>
> The syntax for the filter would be (watch line wrapping):
>
> -r
> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
>
> Wildcards are not allowed and you must specify the full distinguished names.
> The "|" (pipe symbol) is the "OR" operator.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
Author
10 Oct 2007 4:44 PM
Richard Mueller [MVP]
You can prompt in vb or VBScript. The trick is how to prompt for multiple
values. Do you always prompt for 4 values, or keep prompting until the user
enters a blank? Do you assume the parent container/OU of the groups? Do you
prompt for Common Name or just a 3 digit number and append "H" to it. An
example could be (not tested):

' Prompt for group names and construct the filter.
strCN = ""
strFilter = "(|"
Do
    strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
    If (strCN <> "") Then
        strFilter = strFilter & "(memberOf=cn=" & strCN _
            & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
    End If
Loop While strCN <> ""

strFilter = strFilter & ")"

' Use the WshShell object to run the csvde command.
If strFilter <> "(|)" Then
    Set objShell = CreateObject("Wscript.Shell")
    strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r " &
strFilter
    strCmd = strCmd & " -l
sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
    strCmd = strCmd & "-SERVER.DOM.co.uk"
    objShell.Run strCmd
End If

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

Show quote
"PK" <P*@discussions.microsoft.com> wrote in message
news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
> Rich can this be built in to VB some how..?
>
> with like a window to promps for group numbers..?
>
> other than that works a charm
>
> "Richard Mueller [MVP]" wrote:
>
>> Paul wrote:
>>
>> > I got the below to work ok, ( I can also export the entire OU)
>> >
>> > csvde -f C:\Get-Group\GroupMembers.csv -r
>> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
>> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>> > -SERVER.DOM.co.uk
>> >
>> > But i need to export all members of just 4 groups (from the same OU)
>> > Not
>> > just H050 ie i need to include H051 H052 H053 also..
>> >
>> > Any options \ideas.
>> >
>>
>> The syntax for the filter would be (watch line wrapping):
>>
>> -r
>> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
>>
>> Wildcards are not allowed and you must specify the full distinguished
>> names.
>> The "|" (pipe symbol) is the "OR" operator.
>>
>> --
>> Richard Mueller
>> Microsoft MVP Scripting and ADSI
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>>
Author
10 Oct 2007 5:07 PM
PK
Hi Richard

The "H" represents the current year of students. Eg next year will be "I"
the groups are always 4 digits long EG I301 H508

Heres the over all of what i need to acomplish.
my -I commmands are a little over anxious and were in use for other quiries
testing.

In this instance i realy only need forename (LDAP= givenName) to be
generated to the .csv it should automatically go in coloum B as DN ocupies
column (A by default it seems).
then i need to delete Column A
and run a formula against the remainig data.
so i can generate first 3 letters of forename in lowercase and that is all
that is left in my .csv file

This will then be used in conjunction with a password generator to output:

2 numbers and a special caracter.
then auto save this as a .txt file.

My developers have written an app which will import the data left over to a
field in AD and resep the password aswell

Thanks for all your assistance im learning loads powerfull tools..!
Paul

Show quote
"Richard Mueller [MVP]" wrote:

> You can prompt in vb or VBScript. The trick is how to prompt for multiple
> values. Do you always prompt for 4 values, or keep prompting until the user
> enters a blank? Do you assume the parent container/OU of the groups? Do you
> prompt for Common Name or just a 3 digit number and append "H" to it. An
> example could be (not tested):
>
> ' Prompt for group names and construct the filter.
> strCN = ""
> strFilter = "(|"
> Do
>     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
>     If (strCN <> "") Then
>         strFilter = strFilter & "(memberOf=cn=" & strCN _
>             & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
>     End If
> Loop While strCN <> ""
>
> strFilter = strFilter & ")"
>
> ' Use the WshShell object to run the csvde command.
> If strFilter <> "(|)" Then
>     Set objShell = CreateObject("Wscript.Shell")
>     strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r " &
> strFilter
>     strCmd = strCmd & " -l
> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
>     strCmd = strCmd & "-SERVER.DOM.co.uk"
>     objShell.Run strCmd
> End If
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "PK" <P*@discussions.microsoft.com> wrote in message
> news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
> > Rich can this be built in to VB some how..?
> >
> > with like a window to promps for group numbers..?
> >
> > other than that works a charm
> >
> > "Richard Mueller [MVP]" wrote:
> >
> >> Paul wrote:
> >>
> >> > I got the below to work ok, ( I can also export the entire OU)
> >> >
> >> > csvde -f C:\Get-Group\GroupMembers.csv -r
> >> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
> >> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> >> > -SERVER.DOM.co.uk
> >> >
> >> > But i need to export all members of just 4 groups (from the same OU)
> >> > Not
> >> > just H050 ie i need to include H051 H052 H053 also..
> >> >
> >> > Any options \ideas.
> >> >
> >>
> >> The syntax for the filter would be (watch line wrapping):
> >>
> >> -r
> >> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
> >>
> >> Wildcards are not allowed and you must specify the full distinguished
> >> names.
> >> The "|" (pipe symbol) is the "OR" operator.
> >>
> >> --
> >> Richard Mueller
> >> Microsoft MVP Scripting and ADSI
> >> Hilltop Lab - http://www.rlmueller.net
> >> --
> >>
> >>
> >>
>
>
>
Author
10 Oct 2007 9:16 PM
PK
Richard

Got the script to run no errors occour.
However no CSV is generated, nor output made.

Paul

Show quote
"PK" wrote:

> Hi Richard
>
> The "H" represents the current year of students. Eg next year will be "I"
> the groups are always 4 digits long EG I301 H508
>
> Heres the over all of what i need to acomplish.
> my -I commmands are a little over anxious and were in use for other quiries
> testing.
>
> In this instance i realy only need forename (LDAP= givenName) to be
> generated to the .csv it should automatically go in coloum B as DN ocupies
> column (A by default it seems).
> then i need to delete Column A
> and run a formula against the remainig data.
> so i can generate first 3 letters of forename in lowercase and that is all
> that is left in my .csv file
>
> This will then be used in conjunction with a password generator to output:
>
> 2 numbers and a special caracter.
> then auto save this as a .txt file.
>
> My developers have written an app which will import the data left over to a
> field in AD and resep the password aswell
>
> Thanks for all your assistance im learning loads powerfull tools..!
> Paul
>
> "Richard Mueller [MVP]" wrote:
>
> > You can prompt in vb or VBScript. The trick is how to prompt for multiple
> > values. Do you always prompt for 4 values, or keep prompting until the user
> > enters a blank? Do you assume the parent container/OU of the groups? Do you
> > prompt for Common Name or just a 3 digit number and append "H" to it. An
> > example could be (not tested):
> >
> > ' Prompt for group names and construct the filter.
> > strCN = ""
> > strFilter = "(|"
> > Do
> >     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
> >     If (strCN <> "") Then
> >         strFilter = strFilter & "(memberOf=cn=" & strCN _
> >             & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
> >     End If
> > Loop While strCN <> ""
> >
> > strFilter = strFilter & ")"
> >
> > ' Use the WshShell object to run the csvde command.
> > If strFilter <> "(|)" Then
> >     Set objShell = CreateObject("Wscript.Shell")
> >     strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r " &
> > strFilter
> >     strCmd = strCmd & " -l
> > sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
> >     strCmd = strCmd & "-SERVER.DOM.co.uk"
> >     objShell.Run strCmd
> > End If
> >
> > --
> > Richard Mueller
> > Microsoft MVP Scripting and ADSI
> > Hilltop Lab - http://www.rlmueller.net
> > --
> >
> > "PK" <P*@discussions.microsoft.com> wrote in message
> > news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
> > > Rich can this be built in to VB some how..?
> > >
> > > with like a window to promps for group numbers..?
> > >
> > > other than that works a charm
> > >
> > > "Richard Mueller [MVP]" wrote:
> > >
> > >> Paul wrote:
> > >>
> > >> > I got the below to work ok, ( I can also export the entire OU)
> > >> >
> > >> > csvde -f C:\Get-Group\GroupMembers.csv -r
> > >> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
> > >> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> > >> > -SERVER.DOM.co.uk
> > >> >
> > >> > But i need to export all members of just 4 groups (from the same OU)
> > >> > Not
> > >> > just H050 ie i need to include H051 H052 H053 also..
> > >> >
> > >> > Any options \ideas.
> > >> >
> > >>
> > >> The syntax for the filter would be (watch line wrapping):
> > >>
> > >> -r
> > >> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
> > >>
> > >> Wildcards are not allowed and you must specify the full distinguished
> > >> names.
> > >> The "|" (pipe symbol) is the "OR" operator.
> > >>
> > >> --
> > >> Richard Mueller
> > >> Microsoft MVP Scripting and ADSI
> > >> Hilltop Lab - http://www.rlmueller.net
> > >> --
> > >>
> > >>
> > >>
> >
> >
> >
Author
10 Oct 2007 9:44 PM
Richard Mueller [MVP]
I see I forgot the -f in my example:

strCmd = "%comspec% /c csvde -f c:\get-group\GroupMembers.csv -r " &
strFilter

If there is an error in the command passed to the Run method, you won't see
it. (unless you use /k instead of /c in the command). You can have the
script echo the final value of the variable strCmd, so you can tell if it is
a valid command. It can be hard to get all the spaces, commas, dashes, etc.
correct. I built the value assigned to strCmd in several steps to avoid line
wrapping.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Show quote
"PK" <P*@discussions.microsoft.com> wrote in message
news:5DBCC75A-C00F-419E-925D-8E92E2B9C924@microsoft.com...
> Richard
>
> Got the script to run no errors occour.
> However no CSV is generated, nor output made.
>
> Paul
>
> "PK" wrote:
>
>> Hi Richard
>>
>> The "H" represents the current year of students. Eg next year will be "I"
>> the groups are always 4 digits long EG I301 H508
>>
>> Heres the over all of what i need to acomplish.
>> my -I commmands are a little over anxious and were in use for other
>> quiries
>> testing.
>>
>> In this instance i realy only need forename (LDAP= givenName) to be
>> generated to the .csv it should automatically go in coloum B as DN
>> ocupies
>> column (A by default it seems).
>> then i need to delete Column A
>> and run a formula against the remainig data.
>> so i can generate first 3 letters of forename in lowercase and that is
>> all
>> that is left in my .csv file
>>
>> This will then be used in conjunction with a password generator to
>> output:
>>
>> 2 numbers and a special caracter.
>> then auto save this as a .txt file.
>>
>> My developers have written an app which will import the data left over to
>> a
>> field in AD and resep the password aswell
>>
>> Thanks for all your assistance im learning loads powerfull tools..!
>> Paul
>>
>> "Richard Mueller [MVP]" wrote:
>>
>> > You can prompt in vb or VBScript. The trick is how to prompt for
>> > multiple
>> > values. Do you always prompt for 4 values, or keep prompting until the
>> > user
>> > enters a blank? Do you assume the parent container/OU of the groups? Do
>> > you
>> > prompt for Common Name or just a 3 digit number and append "H" to it.
>> > An
>> > example could be (not tested):
>> >
>> > ' Prompt for group names and construct the filter.
>> > strCN = ""
>> > strFilter = "(|"
>> > Do
>> >     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
>> >     If (strCN <> "") Then
>> >         strFilter = strFilter & "(memberOf=cn=" & strCN _
>> >             & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
>> >     End If
>> > Loop While strCN <> ""
>> >
>> > strFilter = strFilter & ")"
>> >
>> > ' Use the WshShell object to run the csvde command.
>> > If strFilter <> "(|)" Then
>> >     Set objShell = CreateObject("Wscript.Shell")
>> >     strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r " &
>> > strFilter
>> >     strCmd = strCmd & " -l
>> > sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
>> >     strCmd = strCmd & "-SERVER.DOM.co.uk"
>> >     objShell.Run strCmd
>> > End If
>> >
>> > --
>> > Richard Mueller
>> > Microsoft MVP Scripting and ADSI
>> > Hilltop Lab - http://www.rlmueller.net
>> > --
>> >
>> > "PK" <P*@discussions.microsoft.com> wrote in message
>> > news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
>> > > Rich can this be built in to VB some how..?
>> > >
>> > > with like a window to promps for group numbers..?
>> > >
>> > > other than that works a charm
>> > >
>> > > "Richard Mueller [MVP]" wrote:
>> > >
>> > >> Paul wrote:
>> > >>
>> > >> > I got the below to work ok, ( I can also export the entire OU)
>> > >> >
>> > >> > csvde -f C:\Get-Group\GroupMembers.csv -r
>> > >> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
>> > >> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>> > >> > -SERVER.DOM.co.uk
>> > >> >
>> > >> > But i need to export all members of just 4 groups (from the same
>> > >> > OU)
>> > >> > Not
>> > >> > just H050 ie i need to include H051 H052 H053 also..
>> > >> >
>> > >> > Any options \ideas.
>> > >> >
>> > >>
>> > >> The syntax for the filter would be (watch line wrapping):
>> > >>
>> > >> -r
>> > >> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
>> > >>
>> > >> Wildcards are not allowed and you must specify the full
>> > >> distinguished
>> > >> names.
>> > >> The "|" (pipe symbol) is the "OR" operator.
>> > >>
>> > >> --
>> > >> Richard Mueller
>> > >> Microsoft MVP Scripting and ADSI
>> > >> Hilltop Lab - http://www.rlmueller.net
>> > >> --
>> > >>
>> > >>
>> > >>
>> >
>> >
>> >
Author
10 Oct 2007 10:02 PM
PK
Sorry richard still nothing...
Tried the \k in place of the \c and did show any error

Paul

Show quote
"Richard Mueller [MVP]" wrote:

> I see I forgot the -f in my example:
>
> strCmd = "%comspec% /c csvde -f c:\get-group\GroupMembers.csv -r " &
> strFilter
>
> If there is an error in the command passed to the Run method, you won't see
> it. (unless you use /k instead of /c in the command). You can have the
> script echo the final value of the variable strCmd, so you can tell if it is
> a valid command. It can be hard to get all the spaces, commas, dashes, etc.
> correct. I built the value assigned to strCmd in several steps to avoid line
> wrapping.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
> "PK" <P*@discussions.microsoft.com> wrote in message
> news:5DBCC75A-C00F-419E-925D-8E92E2B9C924@microsoft.com...
> > Richard
> >
> > Got the script to run no errors occour.
> > However no CSV is generated, nor output made.
> >
> > Paul
> >
> > "PK" wrote:
> >
> >> Hi Richard
> >>
> >> The "H" represents the current year of students. Eg next year will be "I"
> >> the groups are always 4 digits long EG I301 H508
> >>
> >> Heres the over all of what i need to acomplish.
> >> my -I commmands are a little over anxious and were in use for other
> >> quiries
> >> testing.
> >>
> >> In this instance i realy only need forename (LDAP= givenName) to be
> >> generated to the .csv it should automatically go in coloum B as DN
> >> ocupies
> >> column (A by default it seems).
> >> then i need to delete Column A
> >> and run a formula against the remainig data.
> >> so i can generate first 3 letters of forename in lowercase and that is
> >> all
> >> that is left in my .csv file
> >>
> >> This will then be used in conjunction with a password generator to
> >> output:
> >>
> >> 2 numbers and a special caracter.
> >> then auto save this as a .txt file.
> >>
> >> My developers have written an app which will import the data left over to
> >> a
> >> field in AD and resep the password aswell
> >>
> >> Thanks for all your assistance im learning loads powerfull tools..!
> >> Paul
> >>
> >> "Richard Mueller [MVP]" wrote:
> >>
> >> > You can prompt in vb or VBScript. The trick is how to prompt for
> >> > multiple
> >> > values. Do you always prompt for 4 values, or keep prompting until the
> >> > user
> >> > enters a blank? Do you assume the parent container/OU of the groups? Do
> >> > you
> >> > prompt for Common Name or just a 3 digit number and append "H" to it.
> >> > An
> >> > example could be (not tested):
> >> >
> >> > ' Prompt for group names and construct the filter.
> >> > strCN = ""
> >> > strFilter = "(|"
> >> > Do
> >> >     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
> >> >     If (strCN <> "") Then
> >> >         strFilter = strFilter & "(memberOf=cn=" & strCN _
> >> >             & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
> >> >     End If
> >> > Loop While strCN <> ""
> >> >
> >> > strFilter = strFilter & ")"
> >> >
> >> > ' Use the WshShell object to run the csvde command.
> >> > If strFilter <> "(|)" Then
> >> >     Set objShell = CreateObject("Wscript.Shell")
> >> >     strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r " &
> >> > strFilter
> >> >     strCmd = strCmd & " -l
> >> > sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
> >> >     strCmd = strCmd & "-SERVER.DOM.co.uk"
> >> >     objShell.Run strCmd
> >> > End If
> >> >
> >> > --
> >> > Richard Mueller
> >> > Microsoft MVP Scripting and ADSI
> >> > Hilltop Lab - http://www.rlmueller.net
> >> > --
> >> >
> >> > "PK" <P*@discussions.microsoft.com> wrote in message
> >> > news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
> >> > > Rich can this be built in to VB some how..?
> >> > >
> >> > > with like a window to promps for group numbers..?
> >> > >
> >> > > other than that works a charm
> >> > >
> >> > > "Richard Mueller [MVP]" wrote:
> >> > >
> >> > >> Paul wrote:
> >> > >>
> >> > >> > I got the below to work ok, ( I can also export the entire OU)
> >> > >> >
> >> > >> > csvde -f C:\Get-Group\GroupMembers.csv -r
> >> > >> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
> >> > >> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> >> > >> > -SERVER.DOM.co.uk
> >> > >> >
> >> > >> > But i need to export all members of just 4 groups (from the same
> >> > >> > OU)
> >> > >> > Not
> >> > >> > just H050 ie i need to include H051 H052 H053 also..
> >> > >> >
> >> > >> > Any options \ideas.
> >> > >> >
> >> > >>
> >> > >> The syntax for the filter would be (watch line wrapping):
> >> > >>
> >> > >> -r
> >> > >> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
> >> > >>
> >> > >> Wildcards are not allowed and you must specify the full
> >> > >> distinguished
> >> > >> names.
> >> > >> The "|" (pipe symbol) is the "OR" operator.
> >> > >>
> >> > >> --
> >> > >> Richard Mueller
> >> > >> Microsoft MVP Scripting and ADSI
> >> > >> Hilltop Lab - http://www.rlmueller.net
> >> > >> --
> >> > >>
> >> > >>
> >> > >>
> >> >
> >> >
> >> >
>
>
>
Author
11 Oct 2007 2:44 AM
Richard Mueller [MVP]
I never even checked the syntax of the command. The "-s" is missing when you
specify a DC. Watch line wrapping:

    strCmd = "%comspec% /c csvde -f c:\get-group\GroupMembers.csv -r " &
strFilter
    strCmd = strCmd & " -l
sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
    strCmd = strCmd & "-s SERVER.DOM.co.uk"

I tested the script and it worked for me. It must be run on a DC. I had to
modify the Distinguished Names for my domain. I also had to modify the file
path.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

Show quote
"PK" <P*@discussions.microsoft.com> wrote in message
news:FF4AF153-7182-41DE-9BBA-9E2070497467@microsoft.com...
> Sorry richard still nothing...
> Tried the \k in place of the \c and did show any error
>
> Paul
>
> "Richard Mueller [MVP]" wrote:
>
>> I see I forgot the -f in my example:
>>
>> strCmd = "%comspec% /c csvde -f c:\get-group\GroupMembers.csv -r " &
>> strFilter
>>
>> If there is an error in the command passed to the Run method, you won't
>> see
>> it. (unless you use /k instead of /c in the command). You can have the
>> script echo the final value of the variable strCmd, so you can tell if it
>> is
>> a valid command. It can be hard to get all the spaces, commas, dashes,
>> etc.
>> correct. I built the value assigned to strCmd in several steps to avoid
>> line
>> wrapping.
>>
>> --
>> Richard Mueller
>> Microsoft MVP Scripting and ADSI
>> Hilltop Lab - http://www.rlmueller.net
>> --
>> "PK" <P*@discussions.microsoft.com> wrote in message
>> news:5DBCC75A-C00F-419E-925D-8E92E2B9C924@microsoft.com...
>> > Richard
>> >
>> > Got the script to run no errors occour.
>> > However no CSV is generated, nor output made.
>> >
>> > Paul
>> >
>> > "PK" wrote:
>> >
>> >> Hi Richard
>> >>
>> >> The "H" represents the current year of students. Eg next year will be
>> >> "I"
>> >> the groups are always 4 digits long EG I301 H508
>> >>
>> >> Heres the over all of what i need to acomplish.
>> >> my -I commmands are a little over anxious and were in use for other
>> >> quiries
>> >> testing.
>> >>
>> >> In this instance i realy only need forename (LDAP= givenName) to be
>> >> generated to the .csv it should automatically go in coloum B as DN
>> >> ocupies
>> >> column (A by default it seems).
>> >> then i need to delete Column A
>> >> and run a formula against the remainig data.
>> >> so i can generate first 3 letters of forename in lowercase and that is
>> >> all
>> >> that is left in my .csv file
>> >>
>> >> This will then be used in conjunction with a password generator to
>> >> output:
>> >>
>> >> 2 numbers and a special caracter.
>> >> then auto save this as a .txt file.
>> >>
>> >> My developers have written an app which will import the data left over
>> >> to
>> >> a
>> >> field in AD and resep the password aswell
>> >>
>> >> Thanks for all your assistance im learning loads powerfull tools..!
>> >> Paul
>> >>
>> >> "Richard Mueller [MVP]" wrote:
>> >>
>> >> > You can prompt in vb or VBScript. The trick is how to prompt for
>> >> > multiple
>> >> > values. Do you always prompt for 4 values, or keep prompting until
>> >> > the
>> >> > user
>> >> > enters a blank? Do you assume the parent container/OU of the groups?
>> >> > Do
>> >> > you
>> >> > prompt for Common Name or just a 3 digit number and append "H" to
>> >> > it.
>> >> > An
>> >> > example could be (not tested):
>> >> >
>> >> > ' Prompt for group names and construct the filter.
>> >> > strCN = ""
>> >> > strFilter = "(|"
>> >> > Do
>> >> >     strCN = InputBox("Enter Common Name of a group or Cancel",
>> >> > "Test")
>> >> >     If (strCN <> "") Then
>> >> >         strFilter = strFilter & "(memberOf=cn=" & strCN _
>> >> >             & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
>> >> >     End If
>> >> > Loop While strCN <> ""
>> >> >
>> >> > strFilter = strFilter & ")"
>> >> >
>> >> > ' Use the WshShell object to run the csvde command.
>> >> > If strFilter <> "(|)" Then
>> >> >     Set objShell = CreateObject("Wscript.Shell")
>> >> >     strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r "
>> >> > &
>> >> > strFilter
>> >> >     strCmd = strCmd & " -l
>> >> > sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
>> >> >     strCmd = strCmd & "-SERVER.DOM.co.uk"
>> >> >     objShell.Run strCmd
>> >> > End If
>> >> >
>> >> > --
>> >> > Richard Mueller
>> >> > Microsoft MVP Scripting and ADSI
>> >> > Hilltop Lab - http://www.rlmueller.net
>> >> > --
>> >> >
>> >> > "PK" <P*@discussions.microsoft.com> wrote in message
>> >> > news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
>> >> > > Rich can this be built in to VB some how..?
>> >> > >
>> >> > > with like a window to promps for group numbers..?
>> >> > >
>> >> > > other than that works a charm
>> >> > >
>> >> > > "Richard Mueller [MVP]" wrote:
>> >> > >
>> >> > >> Paul wrote:
>> >> > >>
>> >> > >> > I got the below to work ok, ( I can also export the entire OU)
>> >> > >> >
>> >> > >> > csvde -f C:\Get-Group\GroupMembers.csv -r
>> >> > >> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
>> >> > >> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>> >> > >> > -SERVER.DOM.co.uk
>> >> > >> >
>> >> > >> > But i need to export all members of just 4 groups (from the
>> >> > >> > same
>> >> > >> > OU)
>> >> > >> > Not
>> >> > >> > just H050 ie i need to include H051 H052 H053 also..
>> >> > >> >
>> >> > >> > Any options \ideas.
>> >> > >> >
>> >> > >>
>> >> > >> The syntax for the filter would be (watch line wrapping):
>> >> > >>
>> >> > >> -r
>> >> > >> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
>> >> > >>
>> >> > >> Wildcards are not allowed and you must specify the full
>> >> > >> distinguished
>> >> > >> names.
>> >> > >> The "|" (pipe symbol) is the "OR" operator.
>> >> > >>
>> >> > >> --
>> >> > >> Richard Mueller
>> >> > >> Microsoft MVP Scripting and ADSI
>> >> > >> Hilltop Lab - http://www.rlmueller.net
>> >> > >> --
>> >> > >>
>> >> > >>
>> >> > >>
>> >> >
>> >> >
>> >> >
>>
>>
>>
Author
11 Oct 2007 9:28 AM
PK
Hi Richard,

Sorry no luck at all here and no .CSV
Sorry to be a pain but im really new to scripting and am still trying to
understand it.

Here is my code run from a DC,  (Uppercase are the parts i have changed)

' Prompt for group names and construct the filter.
strCN = ""
strFilter = "(|"
Do
    strCN = InputBox("Enter Common Name of a group or Cancel", "GET STU
Details")
    If (strCN <> "") Then
        strFilter = strFilter & "(memberOf=cn=" & strCN _
        & ",ou=MYOU,dc=DOMAIN,dc=co,dc=uk)"
    End If
Loop While strCN <> ""

strFilter = strFilter & ")"

' Use the WshShell object to run the csvde command.
If strFilter <> "(|)" Then
    Set objShell = CreateObject("Wscript.Shell")
    strCmd = "%comspec% /c csvde -f e:\get-group\GroupMembers.csv -r " &
strFilter
    strCmd = strCmd & " -l
sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
    strCmd = strCmd & "-s SERVER.DOMAIN.co.uk"
    objShell.Run strCmd

End If

It looks like CSVDE is not running my feeling is because the group names
(from the prompt option) are not being passed.
Can he hardcode a group name into the script to check (H024)

If your code works can you repost your working version.

Kr

Paul

Show quote
"Richard Mueller [MVP]" wrote:

> I never even checked the syntax of the command. The "-s" is missing when you
> specify a DC. Watch line wrapping:
>
>     strCmd = "%comspec% /c csvde -f c:\get-group\GroupMembers.csv -r " &
> strFilter
>     strCmd = strCmd & " -l
> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
>     strCmd = strCmd & "-s SERVER.DOM.co.uk"
>
> I tested the script and it worked for me. It must be run on a DC. I had to
> modify the Distinguished Names for my domain. I also had to modify the file
> path.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "PK" <P*@discussions.microsoft.com> wrote in message
> news:FF4AF153-7182-41DE-9BBA-9E2070497467@microsoft.com...
> > Sorry richard still nothing...
> > Tried the \k in place of the \c and did show any error
> >
> > Paul
> >
> > "Richard Mueller [MVP]" wrote:
> >
> >> I see I forgot the -f in my example:
> >>
> >> strCmd = "%comspec% /c csvde -f c:\get-group\GroupMembers.csv -r " &
> >> strFilter
> >>
> >> If there is an error in the command passed to the Run method, you won't
> >> see
> >> it. (unless you use /k instead of /c in the command). You can have the
> >> script echo the final value of the variable strCmd, so you can tell if it
> >> is
> >> a valid command. It can be hard to get all the spaces, commas, dashes,
> >> etc.
> >> correct. I built the value assigned to strCmd in several steps to avoid
> >> line
> >> wrapping.
> >>
> >> --
> >> Richard Mueller
> >> Microsoft MVP Scripting and ADSI
> >> Hilltop Lab - http://www.rlmueller.net
> >> --
> >> "PK" <P*@discussions.microsoft.com> wrote in message
> >> news:5DBCC75A-C00F-419E-925D-8E92E2B9C924@microsoft.com...
> >> > Richard
> >> >
> >> > Got the script to run no errors occour.
> >> > However no CSV is generated, nor output made.
> >> >
> >> > Paul
> >> >
> >> > "PK" wrote:
> >> >
> >> >> Hi Richard
> >> >>
> >> >> The "H" represents the current year of students. Eg next year will be
> >> >> "I"
> >> >> the groups are always 4 digits long EG I301 H508
> >> >>
> >> >> Heres the over all of what i need to acomplish.
> >> >> my -I commmands are a little over anxious and were in use for other
> >> >> quiries
> >> >> testing.
> >> >>
> >> >> In this instance i realy only need forename (LDAP= givenName) to be
> >> >> generated to the .csv it should automatically go in coloum B as DN
> >> >> ocupies
> >> >> column (A by default it seems).
> >> >> then i need to delete Column A
> >> >> and run a formula against the remainig data.
> >> >> so i can generate first 3 letters of forename in lowercase and that is
> >> >> all
> >> >> that is left in my .csv file
> >> >>
> >> >> This will then be used in conjunction with a password generator to
> >> >> output:
> >> >>
> >> >> 2 numbers and a special caracter.
> >> >> then auto save this as a .txt file.
> >> >>
> >> >> My developers have written an app which will import the data left over
> >> >> to
> >> >> a
> >> >> field in AD and resep the password aswell
> >> >>
> >> >> Thanks for all your assistance im learning loads powerfull tools..!
> >> >> Paul
> >> >>
> >> >> "Richard Mueller [MVP]" wrote:
> >> >>
> >> >> > You can prompt in vb or VBScript. The trick is how to prompt for
> >> >> > multiple
> >> >> > values. Do you always prompt for 4 values, or keep prompting until
> >> >> > the
> >> >> > user
> >> >> > enters a blank? Do you assume the parent container/OU of the groups?
> >> >> > Do
> >> >> > you
> >> >> > prompt for Common Name or just a 3 digit number and append "H" to
> >> >> > it.
> >> >> > An
> >> >> > example could be (not tested):
> >> >> >
> >> >> > ' Prompt for group names and construct the filter.
> >> >> > strCN = ""
> >> >> > strFilter = "(|"
> >> >> > Do
> >> >> >     strCN = InputBox("Enter Common Name of a group or Cancel",
> >> >> > "Test")
> >> >> >     If (strCN <> "") Then
> >> >> >         strFilter = strFilter & "(memberOf=cn=" & strCN _
> >> >> >             & ",ou=mygp,dc=mydom,dc=co,dc=uk)"
> >> >> >     End If
> >> >> > Loop While strCN <> ""
> >> >> >
> >> >> > strFilter = strFilter & ")"
> >> >> >
> >> >> > ' Use the WshShell object to run the csvde command.
> >> >> > If strFilter <> "(|)" Then
> >> >> >     Set objShell = CreateObject("Wscript.Shell")
> >> >> >     strCmd = "%comspec% /c csvde c:\get-group\GroupMembers.csv -r "
> >> >> > &
> >> >> > strFilter
> >> >> >     strCmd = strCmd & " -l
> >> >> > sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf "
> >> >> >     strCmd = strCmd & "-SERVER.DOM.co.uk"
> >> >> >     objShell.Run strCmd
> >> >> > End If
> >> >> >
> >> >> > --
> >> >> > Richard Mueller
> >> >> > Microsoft MVP Scripting and ADSI
> >> >> > Hilltop Lab - http://www.rlmueller.net
> >> >> > --
> >> >> >
> >> >> > "PK" <P*@discussions.microsoft.com> wrote in message
> >> >> > news:2F8920ED-31C0-403A-A615-A348A5A8CF45@microsoft.com...
> >> >> > > Rich can this be built in to VB some how..?
> >> >> > >
> >> >> > > with like a window to promps for group numbers..?
> >> >> > >
> >> >> > > other than that works a charm
> >> >> > >
> >> >> > > "Richard Mueller [MVP]" wrote:
> >> >> > >
> >> >> > >> Paul wrote:
> >> >> > >>
> >> >> > >> > I got the below to work ok, ( I can also export the entire OU)
> >> >> > >> >
> >> >> > >> > csvde -f C:\Get-Group\GroupMembers.csv -r
> >> >> > >> > "memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk" -l
> >> >> > >> > "sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> >> >> > >> > -SERVER.DOM.co.uk
> >> >> > >> >
> >> >> > >> > But i need to export all members of just 4 groups (from the
> >> >> > >> > same
> >> >> > >> > OU)
> >> >> > >> > Not
> >> >> > >> > just H050 ie i need to include H051 H052 H053 also..
> >> >> > >> >
> >> >> > >> > Any options \ideas.
> >> >> > >> >
> >> >> > >>
> >> >> > >> The syntax for the filter would be (watch line wrapping):
> >> >> > >>
> >> >> > >> -r
> >> >> > >> "(|(memberOf=cn=H050,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H051,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H052,ou=mygp,dc=mydom,dc=co,dc=uk)(memberOf=cn=H053,ou=mygp,dc=mydom,dc=co,dc=uk))"
> >> >> > >>
> >> >> > >> Wildcards are not allowed and you must specify the full
> >> >> > >> distinguished
> >> >> > >> names.
> >> >> > >> The "|" (pipe symbol) is the "OR" operator.
> >> >> > >>
> >> >> > >> --
> >> >> > >> Richard Mueller
> >> >> > >> Microsoft MVP Scripting and ADSI
> >> >> > >> Hilltop Lab - http://www.rlmueller.net
> >> >> > >> --
> >> >> > >>
> >> >> > >>
> >> >> > >>
> >> >> >
> >> >> >
> >> >> >
> >>
> >>
> >>
>
>
>
Author
11 Oct 2007 1:33 PM
Richard Mueller [MVP]
Sorry about that. I got the csvde command to work, but had not tried it in
the script. First, you were missing a space between "memberOf" and "-s". The
problem, however, was that the filter must be enclosed in quotes. The
version that worked for me (watch line wrapping):
==============
' Prompt for group names and construct the filter.
strCN = ""
strFilter = "(|"
Do
    strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
    If (strCN <> "") Then
        strFilter = strFilter & "(memberOf=cn=" & strCN _
            & ",ou=School,dc=MyDomain,dc=com)"
    End If
Loop While strCN <> ""

strFilter = strFilter & ")"

' Use the WshShell object to run the csvde command.
If strFilter <> "(|)" Then
    Set objShell = CreateObject("Wscript.Shell")
    strCmd = "%comspec% /c csvde -f c:\rlm\scripts\GroupMembers.csv -r """ &
strFilter & """"
    strCmd = strCmd & " -l
sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
    strCmd = strCmd & " -s Wisconsin.MyDomain.com"
    objShell.Run strCmd
End If
==============
You need the extra space and the added quotes. To have a quote within a
quoted string, you must double them. So """" is a single quote character in
a quoted string. You must also use your domain components in place of mine.
I believe a version that would work for you would be:
==============
' Prompt for group names and construct the filter.
strCN = ""
strFilter = "(|"
Do
    strCN = InputBox("Enter Common Name of a group or Cancel", "GET STU
Details")
    If (strCN <> "") Then
        strFilter = strFilter & "(memberOf=cn=" & strCN _
            & ",ou=MYOU,dc=DOMAIN,dc=co,dc=uk)"
    End If
Loop While strCN <> ""

strFilter = strFilter & ")"

' Use the WshShell object to run the csvde command.
If strFilter <> "(|)" Then
    Set objShell = CreateObject("Wscript.Shell")
    strCmd = "%comspec% /c csvde -f e:\get-group\GroupMembers.csv -r """ &
strFilter & """"
    strCmd = strCmd & " -l
sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
    strCmd = strCmd & " -s SERVER.DOMAIN.co.uk"
    objShell.Run strCmd
End If
===========
Sorry for the trouble.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
11 Oct 2007 2:11 PM
PK
AWW Mate that is just the best.....!!
Spot on..any idea how do delete column A and row one from .CSV now


Show quote
"Richard Mueller [MVP]" wrote:

> Sorry about that. I got the csvde command to work, but had not tried it in
> the script. First, you were missing a space between "memberOf" and "-s". The
> problem, however, was that the filter must be enclosed in quotes. The
> version that worked for me (watch line wrapping):
> ==============
> ' Prompt for group names and construct the filter.
> strCN = ""
> strFilter = "(|"
> Do
>     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
>     If (strCN <> "") Then
>         strFilter = strFilter & "(memberOf=cn=" & strCN _
>             & ",ou=School,dc=MyDomain,dc=com)"
>     End If
> Loop While strCN <> ""
>
> strFilter = strFilter & ")"
>
> ' Use the WshShell object to run the csvde command.
> If strFilter <> "(|)" Then
>     Set objShell = CreateObject("Wscript.Shell")
>     strCmd = "%comspec% /c csvde -f c:\rlm\scripts\GroupMembers.csv -r """ &
> strFilter & """"
>     strCmd = strCmd & " -l
> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>     strCmd = strCmd & " -s Wisconsin.MyDomain.com"
>     objShell.Run strCmd
> End If
> ==============
> You need the extra space and the added quotes. To have a quote within a
> quoted string, you must double them. So """" is a single quote character in
> a quoted string. You must also use your domain components in place of mine.
> I believe a version that would work for you would be:
> ==============
> ' Prompt for group names and construct the filter.
> strCN = ""
> strFilter = "(|"
> Do
>     strCN = InputBox("Enter Common Name of a group or Cancel", "GET STU
> Details")
>     If (strCN <> "") Then
>         strFilter = strFilter & "(memberOf=cn=" & strCN _
>             & ",ou=MYOU,dc=DOMAIN,dc=co,dc=uk)"
>     End If
> Loop While strCN <> ""
>
> strFilter = strFilter & ")"
>
> ' Use the WshShell object to run the csvde command.
> If strFilter <> "(|)" Then
>     Set objShell = CreateObject("Wscript.Shell")
>     strCmd = "%comspec% /c csvde -f e:\get-group\GroupMembers.csv -r """ &
> strFilter & """"
>     strCmd = strCmd & " -l
> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>     strCmd = strCmd & " -s SERVER.DOMAIN.co.uk"
>     objShell.Run strCmd
> End If
> ===========
> Sorry for the trouble.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
Author
11 Oct 2007 3:45 PM
Richard Mueller [MVP]
I'm glad the script worked. I know of now way to keep the csvde command from
outputing the DN (Distinguished Name) in the first column. This uniquely
identifies the object and is always displayed whether you ask for it or not.
The first row is the list of attribute names, and again this cannot be
suppressed. The output can be read into a spreadsheet program where these
can be deleted if desired.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

Show quote
"PK" <P*@discussions.microsoft.com> wrote in message
news:FD2DBD34-7F69-40B0-A419-C17A25BD97A8@microsoft.com...
> AWW Mate that is just the best.....!!
> Spot on..any idea how do delete column A and row one from .CSV now
>
>
> "Richard Mueller [MVP]" wrote:
>
>> Sorry about that. I got the csvde command to work, but had not tried it
>> in
>> the script. First, you were missing a space between "memberOf" and "-s".
>> The
>> problem, however, was that the filter must be enclosed in quotes. The
>> version that worked for me (watch line wrapping):
>> ==============
>> ' Prompt for group names and construct the filter.
>> strCN = ""
>> strFilter = "(|"
>> Do
>>     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
>>     If (strCN <> "") Then
>>         strFilter = strFilter & "(memberOf=cn=" & strCN _
>>             & ",ou=School,dc=MyDomain,dc=com)"
>>     End If
>> Loop While strCN <> ""
>>
>> strFilter = strFilter & ")"
>>
>> ' Use the WshShell object to run the csvde command.
>> If strFilter <> "(|)" Then
>>     Set objShell = CreateObject("Wscript.Shell")
>>     strCmd = "%comspec% /c csvde -f c:\rlm\scripts\GroupMembers.csv -r
>> """ &
>> strFilter & """"
>>     strCmd = strCmd & " -l
>> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>>     strCmd = strCmd & " -s Wisconsin.MyDomain.com"
>>     objShell.Run strCmd
>> End If
>> ==============
>> You need the extra space and the added quotes. To have a quote within a
>> quoted string, you must double them. So """" is a single quote character
>> in
>> a quoted string. You must also use your domain components in place of
>> mine.
>> I believe a version that would work for you would be:
>> ==============
>> ' Prompt for group names and construct the filter.
>> strCN = ""
>> strFilter = "(|"
>> Do
>>     strCN = InputBox("Enter Common Name of a group or Cancel", "GET STU
>> Details")
>>     If (strCN <> "") Then
>>         strFilter = strFilter & "(memberOf=cn=" & strCN _
>>             & ",ou=MYOU,dc=DOMAIN,dc=co,dc=uk)"
>>     End If
>> Loop While strCN <> ""
>>
>> strFilter = strFilter & ")"
>>
>> ' Use the WshShell object to run the csvde command.
>> If strFilter <> "(|)" Then
>>     Set objShell = CreateObject("Wscript.Shell")
>>     strCmd = "%comspec% /c csvde -f e:\get-group\GroupMembers.csv -r """
>> &
>> strFilter & """"
>>     strCmd = strCmd & " -l
>> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
>>     strCmd = strCmd & " -s SERVER.DOMAIN.co.uk"
>>     objShell.Run strCmd
>> End If
>> ===========
>> Sorry for the trouble.
>>
>> --
>> Richard Mueller
>> Microsoft MVP Scripting and ADSI
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>>
Author
11 Oct 2007 8:51 PM
PK
hi Richard

I have realised DN and Line 1 are defaults by now.

However i have written 2 more VB scripts to remove\delete them ive tested
both bits of vbs code work independantly.

Im stuck as to how to "bolt" them all together though.

Paul


Show quote
"Richard Mueller [MVP]" wrote:

> I'm glad the script worked. I know of now way to keep the csvde command from
> outputing the DN (Distinguished Name) in the first column. This uniquely
> identifies the object and is always displayed whether you ask for it or not.
> The first row is the list of attribute names, and again this cannot be
> suppressed. The output can be read into a spreadsheet program where these
> can be deleted if desired.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "PK" <P*@discussions.microsoft.com> wrote in message
> news:FD2DBD34-7F69-40B0-A419-C17A25BD97A8@microsoft.com...
> > AWW Mate that is just the best.....!!
> > Spot on..any idea how do delete column A and row one from .CSV now
> >
> >
> > "Richard Mueller [MVP]" wrote:
> >
> >> Sorry about that. I got the csvde command to work, but had not tried it
> >> in
> >> the script. First, you were missing a space between "memberOf" and "-s".
> >> The
> >> problem, however, was that the filter must be enclosed in quotes. The
> >> version that worked for me (watch line wrapping):
> >> ==============
> >> ' Prompt for group names and construct the filter.
> >> strCN = ""
> >> strFilter = "(|"
> >> Do
> >>     strCN = InputBox("Enter Common Name of a group or Cancel", "Test")
> >>     If (strCN <> "") Then
> >>         strFilter = strFilter & "(memberOf=cn=" & strCN _
> >>             & ",ou=School,dc=MyDomain,dc=com)"
> >>     End If
> >> Loop While strCN <> ""
> >>
> >> strFilter = strFilter & ")"
> >>
> >> ' Use the WshShell object to run the csvde command.
> >> If strFilter <> "(|)" Then
> >>     Set objShell = CreateObject("Wscript.Shell")
> >>     strCmd = "%comspec% /c csvde -f c:\rlm\scripts\GroupMembers.csv -r
> >> """ &
> >> strFilter & """"
> >>     strCmd = strCmd & " -l
> >> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> >>     strCmd = strCmd & " -s Wisconsin.MyDomain.com"
> >>     objShell.Run strCmd
> >> End If
> >> ==============
> >> You need the extra space and the added quotes. To have a quote within a
> >> quoted string, you must double them. So """" is a single quote character
> >> in
> >> a quoted string. You must also use your domain components in place of
> >> mine.
> >> I believe a version that would work for you would be:
> >> ==============
> >> ' Prompt for group names and construct the filter.
> >> strCN = ""
> >> strFilter = "(|"
> >> Do
> >>     strCN = InputBox("Enter Common Name of a group or Cancel", "GET STU
> >> Details")
> >>     If (strCN <> "") Then
> >>         strFilter = strFilter & "(memberOf=cn=" & strCN _
> >>             & ",ou=MYOU,dc=DOMAIN,dc=co,dc=uk)"
> >>     End If
> >> Loop While strCN <> ""
> >>
> >> strFilter = strFilter & ")"
> >>
> >> ' Use the WshShell object to run the csvde command.
> >> If strFilter <> "(|)" Then
> >>     Set objShell = CreateObject("Wscript.Shell")
> >>     strCmd = "%comspec% /c csvde -f e:\get-group\GroupMembers.csv -r """
> >> &
> >> strFilter & """"
> >>     strCmd = strCmd & " -l
> >> sAMAccountName,givenName,physicalDeliveryOfficeName,memberOf"
> >>     strCmd = strCmd & " -s SERVER.DOMAIN.co.uk"
> >>     objShell.Run strCmd
> >> End If
> >> ===========
> >> Sorry for the trouble.
> >>
> >> --
> >> Richard Mueller
> >> Microsoft MVP Scripting and ADSI
> >> Hilltop Lab - http://www.rlmueller.net
> >> --
> >>
> >>
> >>
>
>
>

AddThis Social Bookmark Button