Showing posts with label PS Scripts. Show all posts
Showing posts with label PS Scripts. Show all posts

Friday, June 26, 2009

Send Mail With Attachment Using PowerGUI

Here is another nice PS script made by PowerGUI and this script will sent “ attachment” along with the e-mail. You can imagine where we will be using this script, all scripts we have created within the PowerGUI can be integrated with this script and we can automatically sent attachments.

Click here to download

image

#Send mail with attachment Script by Oz Casey Dedeal
#Send mail with attachment Script
#Created with PowerGUI
#I cannot thank enough to PowerGUI, it is life saver (-:
#If you want your hands get dirty go download PG from www.powergui.org
# This PS Script is worked by Oz Casey Dedeal all Credits goes to PowerGUI (-:
#Send an email
$FromAddress = "report@telnet25.org"
$ToAddress = "odedeal@telnet25.org"
$MessageSubject = "Mailbox Size Report"
$MessageBody = "Please see the Mailbox report"
# Mail2 is my Relay Server, Change this to your own Relay Server
# Make sure port 25 is open, there is no firewall turned on, might me blocking port 25, if you are not going to run this from relay server itself
$SendingServer = "Mail2"
$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody
# Make sure this directory is Valid, I used C drive and created folder called Report from my workstation
$Attachment = New-Object Net.Mail.Attachment("c:\Report\report.csv")
$SMTPMessage.Attachments.Add($Attachment)
$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
$SMTPClient.Send($SMTPMessage)
# now mail is sent check your mailbox

  • You can also copy and paste the script included above table
  • Make sure port 25 is open if you are going to be using your workstation
  • Make sure from your workstation , relay is allowed to the relay server
  • Make sure you can resolve the name of the relay server
  • Make sure you created the folder on your C Drive ( change this as you wish)

image

image

Oz Casey Dedeal

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

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

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

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

Tuesday, June 9, 2009

How to Export Mailbox into PST Exchange 2007

You have seen many of videos and articles but still confused about getting mailbox for such user into PST? No worries you are reading right article and one of the easiest way to accomplish this with no sweating (-: with PoerGUI

if you have not download PowerGUI here is download link

image

  • we need to do little prep work before we get going
  • create a folder in your hard drive and called it PST

image

Open PowerGUI

image

  • on the next windows scroll down and configure the PSTFolderPath
  • D:\PST

image

image

PST will get created on the target location we defined earlier as shown below

image

 

 


Export-Mailbox –Identity <mailboxUser> -PSTFolderPath <pathToSavePST>

image

  • How to Export Mailbox Data
  • How to Export and Import mailboxes to PST files in Exchange 2007

Oz Casey Dedeal

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

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

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

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

Saturday, June 6, 2009

Get-ExchangeServer Mailbox Count

If you want to get quickly the mailbox count on each storage group on specific mail server or all mail servers here is the PS script and PowerGUI usage, remember to include this one to your existing PowerGUI toolbox for daily usage. Exporting these outputs to CSV file is incredibly easy with powerGUI.

PS


Get-ExchangeServer | Get-MailboxDatabase | select Identity,@{n='MailboxCount';e={@(Get-Mailbox -database $_.identity).count}}

Click below to download it

image

One thing I found very convenient to do and more useful for learning PS is to use PowerGUI script editor first to test the PS script to make sure it is producing expected results and when all good open PowerGUI.

  • Open PowerGUI Script Editor
image

  • To run the script press green run arrow on top or simply use
  • CTRL + F5

image

  • Open PowerGUI now go to your PS Scripts folders
  • right click
  • Script node simply copy and paste the same PS code

image

here is the output

image

And your script library is getting more powerful each time you add another one

 

 

image

those of you who have been fallowing these simple way of building powerful scripting library will already see the power of PS and powerGUI, when you have right tools and right mind set you don't have to be so smart to get the work done (-:

and finally get your free kung-FU Panda Power GUI exchange BG and hope you like it , click on the picture to go to my SkyDrive to download the free Backgrounds

image

Cheers,

oz

Oz Casey Dedeal

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

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

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

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

Friday, June 5, 2009

Get-ExchangeServer PS with PowerGUI

Here is another PS Script to get to know the version of exchange servers in your SMTP org. The reason I am posting these PS scripts one by one to show you guys how easy your life will be with PS and PowerGUI, when you get a hold off it  and you can always customize the powerGUI the way you like and increase your productivity and make daily task pretty easy for yourself.

I believe powerGUI is one of the ***Best*** tool out there to make your life easy and you need to take advantage of this powerful tool and learn skill you need to get the work done.

PS Script

image


Get-ExchangeServer | Format-Table Name, *Version*

Open PowerGUI Script Editor this time and copy and paste the above PS Script as shown below

image

when you hit run or CTRL + F5 here is output

image

Now you verified the PS script is working and you wish to move this to your script library , you open this time PowerGUI and drill down to PS Scripts folder we created earlier ( See other post in PS section of my blog)

  • make right click
  • new ,script node
  • Give it a name as shown below
  • Remember use

image

as you see the result pane on the right hand

image

One last thing I would like to mention on the result pane, you can always make right click and choose more filed to be added into script

image

Even click more to get more options, as you see my scripting folder is getting more content based on my needs and you can always export them if you are willingly to share (-:

image

PS is great, PowerGUI rocks and to be honest not having PS scripting skill in couple more years will “Hurt” you (-:

Cheers,

Oz Casey Dedeal

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

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

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

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

Wednesday, June 3, 2009

Get-MailboxDatabase -Status

I will list some of basic PS scripts on my blog site and I also show you how to build and shape your own PowerGUI tool, as I said several times PowerGUI is incredible powerful and easy to use, the best part is you don't have to know much to get going………

First download and install PowerGUI

Second When you open power GUI create a folder under Exchange anywhere and call it anything you like , I called mine “PS Scripts”

image

Now I will show you how to create ready to go PS scripts to make your daily job easy and once you understand you can use your imagination and extend your own script folder.

Now on the folder

  • Right click
  • new
  • Script node

image

This is what you will get , let me explain what # does actually within the PS Script, it means “comment out” click here for more info

image

Name=Get-MailboxDatabase –Status

copy and paste the PS code in the body as shown below


Get-MailboxDatabase -Status Format-Table Name, Server, Mounted

image

Download here

image

image

You can easily use same PS Script on PowerGUI Script editor

image

Please pay attention to comment out section I tried to give you more information

Now you know how to make PS scripts easy work and enjoy the power of PS with PowerGUI

I will post least one more PS script for everyone so you can add easily your your tool box within the PowerGUI and imagine soon you will have everything you need click away from you

All credits goes to PowerGUI team and thanks million for this incredible tool

Cheers,

Oz Casey Dedeal

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

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

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

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

POWER GUI PowerShell

You might have listened many people saying, learn PS (power Shell) if you are going to be administering Exchange and AD from now on you have to start learning PS and yes this is true every ITPro will have to know some basic and advance PS when it comes to managing both environment.

You think you are late and what are you going to do, you are not even scripting person???

don't worry here is the best tool I have ever seen so far, which will get you going fast , PowerGUI

image

Click here to download power GUI

image

I will start blogging about how to use power GUI with many shortcuts mostly Exchange and Active directory management, it would be great idea to register (free) on power GUI website and start spending time on their forums. You will appreciate power GUI and be amazed what you can do with it (-:

Cheers,

Oz Casey Dedeal

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

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

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

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