+ Reply to Thread
Results 1 to 7 of 7
  1. Senior Member
    Join Date
    May 2006
    Posts
    1,959

    Certifications
    CISSP, CCSP, eJPT, ITIL,PA ACE,Qualys Certified Specialist, A+
    #1

    Default Powershell command get-ADGroupMember export to file

    I'm having some issues running this command, not sure if i have insufficient rights or if it's something else. To be more specific.
    I can run the command get-adgroupmember and then I'm being prompted to enter an identity. I enter the group name as a parameter and the command executes. However once it has been completed i cannont scroll up and export all the group members.
    So instead i run the following command get-adgroupmember -identity"group1" | select name | Export-csv -path C:\output\group.csv -notypeinformation
    i hit enter and i get "》" and there is no output file anywhere. Am I running the command correctly?
    Reply With Quote Quote  

  2. SS -->
  3. Questionably Benevolent Moderator Slowhand's Avatar
    Join Date
    Oct 2005
    Location
    Bay Area, CA
    Posts
    5,073
    Blog Entries
    1

    Certifications
    A+, Linux+, Server+, Security+, MCSA 2003, MCSA 2008, MCSA 2012, CCNA(expired), ITIL Foundation v3 (2011), VCP5-DCV, VCA-Cloud, VCA-DCV, VCA-WM
    #2
    I tried the same thing, and I'm not getting an error or the "expected input" prompt. It runs and exports to a csv just fine. I'm assuming that you're running this on Windows Server 2003 since you posted it in the MCSA/MCSE 2003 section of the forum, but what version of PowerShell are you running?

    -------------------------------------------------------
    ITHumidor.net - "Futuaris nisi irrisus ridebis"
    -------------------------------------------------------

    Free Microsoft Training: Microsoft Virtual Academy
    Free PowerShell Resources: Top 50 PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
    Reply With Quote Quote  

  4. Senior Member
    Join Date
    May 2006
    Posts
    1,959

    Certifications
    CISSP, CCSP, eJPT, ITIL,PA ACE,Qualys Certified Specialist, A+
    #3
    Quote Originally Posted by Slowhand View Post
    I tried the same thing, and I'm not getting an error or the "expected input" prompt. It runs and exports to a csv just fine. I'm assuming that you're running this on Windows Server 2003 since you posted it in the MCSA/MCSE 2003 section of the forum, but what version of PowerShell are you running?
    Slowhand i will have to get you that information in the morning as i am not in the office now. But would the version matter for a command like this? I do not have local admin rights on my machine or elevated access rights in AD. The most i can do is run some queries and searches. Could that be the issue?
    Reply With Quote Quote  

  5. Grumpy old ***** Shdwmage's Avatar
    Join Date
    Oct 2013
    Location
    Michigan
    Posts
    367

    Certifications
    MS70-680,A+,Net+,CIW Bolshevik
    #4
    TheFORCE, are you putting a space between the -identity and the "group1"
    Code:
    get-adgroupmember -identity"group1" | select name | Export-csv -path C:\output\group.csv -notypeinformation
    It should look something like this:
    Code:
    get-adgroupmember -identity "group1" | select name | Export-csv -path C:\output\group.csv -notypeinformation
    Additionally have you tried to run it without the export to see if the core portion of the command is working properly?
    Reply With Quote Quote  

  6. Senior Member
    Join Date
    May 2006
    Posts
    1,959

    Certifications
    CISSP, CCSP, eJPT, ITIL,PA ACE,Qualys Certified Specialist, A+
    #5
    Thanks guys I was able to figure it out. I think the issue might have been the version as Slowhand suggested. I'm using powershell version 2.0. I created the path and an emoty output file and run the command. The information was exported to the file.
    Reply With Quote Quote  

  7. Questionably Benevolent Moderator Slowhand's Avatar
    Join Date
    Oct 2005
    Location
    Bay Area, CA
    Posts
    5,073
    Blog Entries
    1

    Certifications
    A+, Linux+, Server+, Security+, MCSA 2003, MCSA 2008, MCSA 2012, CCNA(expired), ITIL Foundation v3 (2011), VCP5-DCV, VCA-Cloud, VCA-DCV, VCA-WM
    #6
    I was kind of thinking that your issue might've been with the version. Export-CSV was a bit wonky in 2.0. Also, if you didn't have the C:\Output folder already created, that would've given you an error, but it shouldn't have sat there waiting for you to put further input.

    -------------------------------------------------------
    ITHumidor.net - "Futuaris nisi irrisus ridebis"
    -------------------------------------------------------

    Free Microsoft Training: Microsoft Virtual Academy
    Free PowerShell Resources: Top 50 PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
    Reply With Quote Quote  

  8. Senior Member
    Join Date
    May 2006
    Posts
    1,959

    Certifications
    CISSP, CCSP, eJPT, ITIL,PA ACE,Qualys Certified Specialist, A+
    #7
    Quote Originally Posted by Slowhand View Post
    I was kind of thinking that your issue might've been with the version. Export-CSV was a bit wonky in 2.0. Also, if you didn't have the C:\Output folder already created, that would've given you an error, but it shouldn't have sat there waiting for you to put further input.
    Yeah that was probably the issue. The folder not being present. I did some further testing, this time did not create the file and used the existing folder. The command run fine and it created the csv file on its own.
    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks