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

Absolutely lost - PowerShell to audit home share

$
0
0

Basically we have an old Home directory and I would like to dump the entire thing to a CSV file showing the below:

Folder Name | Folder Size | Folder Owner

Folder owner should reflect GUID if we've deleted the user but have not deleted their home directory.

I'd prefer powershell assistance. I think its hopefully as easy as:

$Path = "\\fileserver\homedir"

$Report = "Report.csv"

$Owner = @{
Name = 'Owner'
Expression = { (Get-Acl $_.UserName).Owner }
}

$Fsize = @{
Name = 'Folder Size'
Expression = { (Measure-Object $_.Length).sum }
}

Get-ChildItem -Path $Path | select Name, $Fsize, $Owner | Export-Csv -NoTypeInformation $Report



Viewing all articles
Browse latest Browse all 15370


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