Solved

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

Posted on 2008-10-29
2
934 Views
Last Modified: 2011-10-19
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
0
Comment
Question by:jharen
2 Comments
 
LVL 18

Accepted Solution

by:
BSonPosh earned 500 total points
ID: 22832872
Try This
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 -width 500 > C:\Largefiles.txt

Open in new window

0
 

Author Closing Comment

by:jharen
ID: 31511217
Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Why would I want to create a function for tracking messages? I am glad you asked. As with most monotonous/routine tasks, human error tends to creep in after doing the same task over and over again. By creating a function, you load the function once…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now