Tuesday, July 7, 2009

Scheduled task PowerGUI, E-mailing PS Scripts is very easy…..

Now one of the most asked question how do I get this nice report (PS Script) e-mailed to distribution group with scheduled task, we have touched base on this in the past but we will go over one more time.

If you are not a scripting person this post is perfect for you, if you never script anything in your life you are reading right article, I am sure PowerGUI will make you love PS scripts keep reading,,,,,

but first download PowerGUI (-:

The PS script is uploaded on my skydive for you to download


After downloading the PS script open with PowerGUI Script editor


Now don't forget to change the mail serve name to your own and click on the green arrow to run it

  • Verify the output as below
  • User Name       : Temp11
  • Department      : Temp Employee Office
  • Storage Group   : MAIL2\SG2\SG2-MB1
  • Total Size (MB) : 0
  • itemCount       : 10



Perfect now we need to add into PSCode a little bit, at the end of last line I will start typing Pipe and export as you see below


just because PowerGUI is very hand and smart it is already start helping me, by showing me the possible PS commands associating with export command, this is incredible useful and easy to learn, as you see there is another sub menu help window opened up helping me for my next command which will be “path”


If you loose this point your curser back to end of the command the window will re populate for you, same nice future continues to help as shown below



I finish as fallows

  • |export-csv -Path c:\report\UDSTI-Report.csv


after running the script I go back to my script folder to make sure the CSV file is in there


Here is my report


Now you have the report all you need to do is to run another script to e-mail this to yourself or a DL which is listed here

Send Mail With Attachment Using PowerGUI


one you get this working any report you wish to generate will be easy task for you.

As always all credits goes to PowerGUI, if you have not played with PowerGUI , click below link to download and start becoming PS master (-:


oz Casey Dedeal,

MVP (Exchange)
MCSE 2003, M+, S+, MCDST
Security+, Project +, Server +

Http://smtp25.blogspot.com (Blog)

Https://telnet25.spaces.live.com (Blog)

Https://telnet25.worldpress.com (Blog)

No comments: