Link to home
Start Free TrialLog in
Avatar of Albert Widjaja
Albert WidjajaFlag for Australia

asked on

Modifying Powershell script to get the size of the directory ?

Hi,

Can anyone assist in modifying the below script so that it can also list the directory size ?
by combining this script from: https://technet.microsoft.com/en-us/library/ff730945.aspx

and this one to list Home folder from disabled user accounts.

$subFolderItems = (Get-ChildItem $i.FullName | Measure-Object -property length -sum)
$i.FullName + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"

Open in new window


Get-ADUser -SearchBase "OU=Disabled USERS,OU=Main Office,DC=domain,DC=com" -F * -Pr HomeDirectory | ?{$_.HomeDirectory} | Select Name,HomeDirectory | Export-CSV C:\report.csv -nti

Open in new window


Get-ADUser -SearchBase "OU=Disabled USERS,OU=Main Office,DC=domain,DC=com" -F * -Pr HomeDirectory | ?{$_.HomeDirectory -match "^\\\\FileServerHQ\\Users"} | Select Name,HomeDirectory | Export-CSV C:\report.csv -nti

Open in new window


This is a continuation from this thread: https://www.experts-exchange.com/questions/28972587/Modifying-PowerShell-to-list-home-drives-of-disabled-users.html?anchorAnswerId=41817693#a41817693

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Albert Widjaja

ASKER

Thanks it works !