Solved

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

Posted on 2008-10-29
2
938 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will help you understand what HashTables are and how to use them in PowerShell.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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