Friday, August 30, 2013

Powershell and Outlook : Create and send a new email using Powershell “OutlookTools” Module.

 

Hi,

I have added a new functionality in “OutlookTools” module. Now we can compose and send a new emails using “New-OutlookEmail” function.

This function also do support adding attachments to the composed email, but for now we can attach only one single file.

“OutlookTools” Module download link: https://github.com/AmanDhally/OutlookTools

Let’s start

 

  1. First download the “OutlooTools.Psm1” and .psd1 file fromhttps://github.com/AmanDhally/OutlookTools
  2. Create a folder Name “OutlookTools” in “Libraries\Documents\WindowsPowershell\Modules
  3. and paste both files there.

12-08-2013 1 
Now open Powershell console and run the cmdlet, 

Import-Module OutlookTools

12-08-2013 2

By running the Get-Command cmdlet, we can see which cmdlet and function this modules had added.

Get-Command -Module outlooktools

0

You can see now , we have New-OutlookEmail listed in Function.

How to use it?

It’s simple.

Create a new email.

We are creating a new email , to amandhally@gmail.com with subject “Sending from Powershell” and with body text “Heya its working”

New-OutlookEmail -To amandhally@gmail.com -Subject "Sending from Powershell" -Body "Heya! its working"

1

and when you hit enter, you encountered this problem. ,

I haven’t solved it yet and i am working on it. :( .

2 

but when you click on “Allow”. this will send an email.

You can see, the email is come to our Sent Items folder.

3

and i received it on my Gmail id too.

4

Now create an email with attachment.

Now , we are creating a new email , with attachment, and with High Priority.

New-OutlookEmail -To "amandhally@gmail.com" -Subject "Attaching file"  -Attachment 'D:\a.txt' -importance 2

5

now when you click on send, the above problem comes again with one more confirmation box.,

6

7

once you click on Allows on both.

the email will be in Sent Item

8

and i received it on my Gmail id with attachments too.

9

“OutlookTools” Module download link: https://github.com/AmanDhally/OutlookTools

i hope you will like it.

Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Thursday, August 22, 2013

Powershell and Outlook : Find your default Outlook Profile name using Powershell.

 

Hi,

Good Afternoon everyone.

Today while working on my “OutlookTools” , one question  strike in my mind.

The question was “How to find out default profile name for the Outlook?”.

Finding the default profile for outlook is a bit handy for scripts. for example you are creating a Outlook profile using some sort of scripts and the name of the Outlook profile is similar across the company, If some user complained about outlook, we may need to check which Outlook Profile he/she is using.

This outlook profile is just a name of the profile.

To find out your default outlook profile name. just run the below two lines of script code.

$outlookApplication = New-Object -ComObject 'Outlook.Application'

 

2

 

$outlookApplication.Application.DefaultProfileName

3 

You can see above that our default outlook profile name is “Office365”

let’s verified it.

4

Bingo :) . it is correct.

I hope you will like it.

Thanks

Tuesday, August 20, 2013

A Letter to you : Why to use Powershell.

 

Hi,

My Dear Friends,

Good Evening.

Hope you all are doing fine. 

Most of the times In my emails , user group meeting , and sometime when I meet with some other technology experts they argue, question or queried  about, “Why to use to use Powershell.”

Today, I thought to answer this question.

“Why to use Powershell?”, first it is a personal choice. Secondly you can perform same task by using Powershell and using other language like Visual basic, C#. There is always more than one Path to same destination.

Firstly, if you already know these languages and you know how they work and you are happy, then there is no need to learn a new language.

But

First Thing, if you are a beginner and you want to learn a scripting language and you want to start with an easy scripting language then in my view Powershell is the only and the best choice.

Second, if you love automation, & you like to automate/script your manual task, then this is language for you.

Third, if you don’t want to spend your whole carrier as just a desktop engineer, and want to move ahead in your carrier then this is the language for you.

Fourth, if you want a good hike in your salary, then this language is for you, by automating manual tasks, creating script to solve certain problems, makes you efficient, productive at work and boosts your overall performance.

Fifth, try to be different from others, I know few young IT professionals, they  work in different teams and by way of introducing Powershell in their work they earned respect within team and their organizations as well as certificates of excellence\ appreciation from their employer.

Sixth, it’s cool, you can do many cool things with Powershell, by writing your own tools, applications, it’s all depends upon your creativity and imaginations. I build a network pinger and STOP watch using Powershell and I Loved it.

Seventh, when you need help on it, online Powershell Community is very active , in ways of  TechNet Gallery, Facebook groups or Powershell forums,  even the authors of famous Powershell books , famous Powershell MVPs  are also active on Powershell Groups and forums., Whenever you get stuck anywhere just shoot the question and you will get the answers within couple of hours.

Eighth, if you are in IT, then this could be of great help to you as the Technology keeps on changing every few months, and the basics  once learned in Powershell can be put to use anywhere, such as manage SQL, SCOM, SCCM, Office 365. The user can manage any of Microsoft technology with Powershell, as now most of the Microsoft technologies are compatible with Powershell.

You can read and see the benefits of using and learning Powershell, there are more benefits but I just chose to write the major ones.

Now it is up to you that you want to learn/use Powershell or not.

The choice is yours. It was always yours.

Choose wisely.

Regards

Aman with Love

clip_image001 clip_image002 clip_image003 clip_image005clip_image007

Monday, August 19, 2013

Powershell and Outlook: Create new Outlook Notes using Powershell “OutlookTools” module.

 

Hi,

Good Evening everyone.

I would like to say thanks to everyone to give me a positive feedback on my “OutlookTools” module.

Now We have a Powershell functions to create new Calendar meeting, contacts, tasks. now its is time to create a outlook notes using Powershell.

“OutlookTools” Module download link: https://github.com/AmanDhally/OutlookTools

Let’s start

 

  1. First download the “OutlooTools.Psm1” and .psd1 file fromhttps://github.com/AmanDhally/OutlookTools
  2. Create a folder Name “OutlookTools” in “Libraries\Documents\WindowsPowershell\Modules
  3. and paste both files there.

12-08-2013 1 
Now open Powershell console and run the cmdlet, 

Import-Module OutlookTools

12-08-2013 2

By running the Get-Command cmdlet, we can see which cmdlet and function this modules had added.

Get-Command -Module outlooktools

You can see now we have a New-OutlookNote function in the module.

1

The Outlook notes has very simple structure. When you create a Note is Outlook, you just click on New and you start typing, and Outlook auto named it as per your first typed line.

But in my “New-OutlookNote” function, i created two parameter, one is title and second is Body. Using –Title parameter you can give a title name for the note and add rest of the note to body.

I have also added the –Color parameter, so that you can create different colour notes from the functions. One thing need to remember is that the value of –Color is in number from 0-4

Value Color
0 Blue
1 Green
2 Red
3 Yellow
4 white

Example-1

Creating a simple Note. with title and a simple body.

New-OutlookNote -Title "Hello" -Body "Hello World"

19-08-2013 1

and here is the our note.

19-08-2013 2

Example-2

Creating another note but with different color.

New-OutlookNote -Title "Brainstroming" -Body "need to purchase some brain storm soft" -Color 2

 

 

19-08-2013 3 

19-08-2013 4

You can download the module from this link. https://github.com/AmanDhally/OutlookTools

I am hoping that you also started loving Powershell and automation :)

Thanks

Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007