Solved

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

Posted on 2008-10-29
2
939 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

691 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