Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Help with getting powershell script to output to csv

$
0
0

Hello,

I have this script that is doing the job that I need it to do, however I cannot for the life of me figure out how to replace the write-output to export-csv and make it work. Here is what I am working with:

Powershell
$ReferenceAccountName='DOMAIN\Username'[string[]]$SearchDirectories=@('X:\SomeDirectory','F:\AnotherDirectory')foreach($RootDirin$SearchDirectories){$DirACL=Get-Acl-Path$RootDirforeach($ACLin$DirACL.Access){if($ACL.IdentityReference-like$ReferenceAccountName){Write-Output$RootDir}}foreach($Directoryin(Get-ChildItem-Path$RootDir-Recurse|`Where-Object-FilterScript{$_.Attributes`-contains'Directory'})){$DirACL=Get-Acl-Path$Directory.FullNameforeach($ACLin$DirACL.Access){if($ACL.IdentityReference-like$ReferenceAccountName){Write-Output$Directory.FullName}}}}...

Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>