WIndows PowerShell Scripting

Posted on 2010-11-08
Last Modified: 2012-05-10
I am trying to get all the security groups attached to specific Shared folders on my Windows 2008 File Server. I have all of the share paths that I want in an excel spreadsheet.I would like to be able to just plug in all the path locations for the folders/shares and incorporate this powershell cmd to get a full listing of all 900 shares.

Get-Acl -Path D:\Data | Format-List accessToString | Out-File -FilePath c:\GroupShareAccess.txt -Append

Does anyone know how I can script this cmd instead of having to use it on each individual path location ?
Question by:sodapop7
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

daveTechSearch earned 300 total points
ID: 34085962
To continue with what you have. First, I'd change the xls file to a csv so it can be easily read in by Powershell
get-content c:\get-acl.csv | foreach { get-acl -path $_ | format-list accessToString} |
    Out-File -FilePath c:\GroupShareAccess.txt -Append
LVL 27

Assisted Solution

KenMcF earned 200 total points
ID: 34085974
You can try this. Just save the column to a text file.

$shares = get-content c:\shares.txt
Foreach ($share in $shares){
Get-Acl -Path $share | Format-List accessToString | Out-File -FilePath c:\GroupShareAccess.txt -Append

Author Closing Comment

ID: 34086923
Thank a lot. This solved my issue. Both solutions worked for me. I just have one more question. Is there a way to include the path along with the security information that this script spits out ?

Expert Comment

ID: 34087113
you can do something like this for including the path

$shares = get-content c:\get-acl.csv 
$shareACLs = "c:\shareACLs.csv"

@(foreach ($share in $shares)
    $share | 
    select  @{Name='ShareDir';Expression={[string]($share)}},@{Name='accessToString';Expression={get-acl $share | select accessToString}}
    }) |
    export-csv $shareACLs -notype

Open in new window


Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question