csv - PowerShell Shares ACL List -
i have script goes each file of 1 shared drive , lists acls, don't want go far because there millions of files , never finish (ran on day , got csv file on 6 gb).
i tried using get-childitem *** doesn't seem work. appreciated. ideally, 2 levels deep nice. thx
$erroractionpreference = "continue" $strcomputer = $env:computername $coldrives = get-psdrive -psprovider filesystem #if ($driveletter -eq "n:\") $startpath = "n:" get-childitem $startpath\*\*\ -recurse | foreach { $fullpath = get-item -literalpath (get-item -literalpath $_.pspath) (get-item -literalpath $fullpath).getaccesscontrol() | select * -expand access | select @{n='server name';e={$strcomputer}}, @{n='full path';e={$fullpath}}, @{n='type';e={if($fullpath.psiscontainer -eq $true) {'d'} else {'f'}}}, @{n='owner';e={$_.owner}}, @{n='trustee';e={$_.identityreference}}, @{n='inherited';e={$_.isinherited}}, @{n='inheritance flags';e={$_.inheritanceflags}}, @{n='ace flags';e={$_.propagationflags}}, @{n='ace type';e={$_.accesscontroltype}}, @{n='access masks';e={$_.filesystemrights}} } | export-csv -notypeinformation –path "c:\stuff\ndriveshares.csv"
you can have leave out files , folders this...
get-childitem -recurse | ?{ $_.psiscontainer }
that should folders or things "iscontainer"
Comments
Post a Comment