locked
question about get-ACL cmdlet RRS feed

  • Question

  • HI All

    for example I have this folder e:\IT , how I show the users who has access to it and export the result to .txt file

    Get-ACL e:\ict | format-list ???

    regards

    Tuesday, September 29, 2015 12:33 PM

Answers

  • Hi Syamand,

    you can use Out-File to store the result to text:

    Get-Acl e:\ict | select -expand Access | Out-File "C:\temp\Permissions1.txt"
    Get-Acl e:\ict | select -expand Access | FT -autosize | Out-File "C:\temp\Permissions2.txt"

    To display it in Excel you want to export it to csv:

    # Most regions
    Get-Acl e:\ict | select -expand Access | Export-Csv "C:\temp\Permissions.csv" -NoTypeInformation -Encoding Default
    
    # Some other regions (eg.: In a German Excel, use this)
    Get-Acl e:\ict | select -expand Access | Export-Csv "C:\temp\Permissions.csv" -NoTypeInformation -Encoding Default -Delimiter ";"

    Different regions may use different delimiters.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Proposed as answer by Mike Laughlin Wednesday, September 30, 2015 11:58 AM
    • Marked as answer by Siyamand Thursday, October 1, 2015 8:36 AM
    Wednesday, September 30, 2015 9:08 AM

All replies

  • Hi Sayamand,

    you do this by calling this:

    Get-Acl e:\ict | select -expand Access 

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Proposed as answer by Mike Laughlin Tuesday, September 29, 2015 12:45 PM
    Tuesday, September 29, 2015 12:36 PM
  • thanks a lot for your reply,

    now I'm getting a better list , but how to export or save the result into .txt file or excel file?

    regards

    Wednesday, September 30, 2015 8:56 AM
  • Hi Syamand,

    you can use Out-File to store the result to text:

    Get-Acl e:\ict | select -expand Access | Out-File "C:\temp\Permissions1.txt"
    Get-Acl e:\ict | select -expand Access | FT -autosize | Out-File "C:\temp\Permissions2.txt"

    To display it in Excel you want to export it to csv:

    # Most regions
    Get-Acl e:\ict | select -expand Access | Export-Csv "C:\temp\Permissions.csv" -NoTypeInformation -Encoding Default
    
    # Some other regions (eg.: In a German Excel, use this)
    Get-Acl e:\ict | select -expand Access | Export-Csv "C:\temp\Permissions.csv" -NoTypeInformation -Encoding Default -Delimiter ";"

    Different regions may use different delimiters.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Proposed as answer by Mike Laughlin Wednesday, September 30, 2015 11:58 AM
    • Marked as answer by Siyamand Thursday, October 1, 2015 8:36 AM
    Wednesday, September 30, 2015 9:08 AM
  • thanks a lot that's what I was looking for....

    Thursday, October 1, 2015 8:37 AM