Link to home
Start Free TrialLog in
Avatar of jharen
jharen

asked on

Powershell script that will get Directory Sizes and email them to the Administrator

I would like to get help with a powershell script that gives me the size in MB or GB of a location on my E drive (Where my exchange logs are located) - which creates a text file and then that file gets emailed to an email address.

I have attached what I have thus far - in regards to getting file size - but I dont know where to change it to specify a certain location.

Also does the script have to be run from where it needs to pull the information?

Anyways I have gotten a little further - see my attached code - now my problem is that the output now says "WARNING: 2 columns do not fit into the display and were removed."

Dir e:\Exchange *.* -rec | sort length -desc | select name,directory, @{name="Size in GB";Expression={[System.Math]::Round($_.length/1073741824,1)}},CreationTime -First 10 | ft -auto > C:\Largefiles.txt

Open in new window

Largefiles.txt
ASKER CERTIFIED SOLUTION
Avatar of BSonPosh
BSonPosh
Flag of United States of America 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 jharen
jharen

ASKER

Thanks