Check Account permissions Existence across multiple file shares


#Check file share permissions using multiple accounts

$Fileshares = "C:\Chaitanya\work","C:\Chaitanya\Work2"

$Accounts = "NT AUTHORITY\Authenticated Users","chaitanya"

$AccessArr = @();

foreach ( $account in $accounts)

{

foreach ($share in $Fileshares)

{

$accessObj = Get-ACL $share | Select-Object `

@{n=’Path’;e={ (Get-Item $_.PSPath).FullName }}, Owner `

-Expand Access|?{$_.IdentityReference -contains $account}

if (-not($accessObj))

{

$AccessArr += [pscustomobject]@{Share=$share;Account=$account}

}

else

{

}

}

}

$AccessArr|Out-GridView -Title "MissingAccounts"

Regards,

Chaitanya

Leave a comment

Design a site like this with WordPress.com
Get started