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 Reply

Create your own website, free on WordPress.com.Create your own website.
Start free