Showing posts with label Get-Command. Show all posts
Showing posts with label Get-Command. Show all posts

Monday, July 14, 2014

PowerShell and Hyper-V : Getting Started with Hyper-V and PowerShell


“ To live is the rarest thing in the world. Most people exist, that is all.― Oscar Wilde ”
After writing article on “Desired State Configuration”, I was thinking about topics on which I can write a similar article series.  Nothing was coming to my mind, as I already covered “Active Directory”, “Desired State configuration”, “DHCP”, “Event Viewer” and other topics.
As I use “Hyper-V” a lot, then I thought why not to write a 0 – 200 level series of articles on “Hyper-V”? to me it seems to be good idea J and I hope you may like it too.
I love "Hyper-v", before using "Hyper-V", I used to have "VMware Workstation" , but after migrating to windows 8.1 and start using "Hyper-V" I never used "VMware Workstation" again.
Let’s get started.
Prerequisites
·        Windows 8.1
·        Try to have at-least 4 GB of minimum Ram.
·        64 Bit processor

Yes, that’s all.
Step 1 :
Go to the BIOS Setting of your System / Laptop and enable Virtualisation.
photo
Step 2 :
    • Boot your System
    • Go to Control Panel
    • Click on "Programs and features"
    • Click on "Turn windows feature On of Off"
    • Select all features and sub features of "Hyper-V"
    • and Click on "OK"
    • 14-07-2014 15-09-49


Step 3 :
    • Open PowerShell Console.
    • There is no need to Import Hyper-V module , as after PowerShell v3, they all auto imported.
      Import-Module Hyper-V

    • 14-07-2014 14-38-13

    • To know the list of all cmdlets imported by Hyper-V module , you can run the simple command
      Get-Command -Module 'Hyper-V'

    • 14-07-2014 14-39-02





Step 4 :


Let's run basic cmdlets for now.




    • To get the list of "Hyper-V" hosts, run the cmdlet, Get-VMHost

    • 14-07-2014 14-40-06

    • If you want to see the list of all virtual machines, just run the cmdlet Get-VM.

    • 14-07-2014 14-40-28

    • and you can see that all of machines are Off. you can cross verify it  by open a Hyper-V management console. Smile 

    • 14-07-2014 14-40-53



That's all of now and hope to see you in next blog post.



Thanks & Regards

Aman Dhally

loki-2







Come and join my journey of : “100 Days of Self Improvement” on




If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

Wednesday, August 14, 2013

Powershell and Outlook: Create a New Outlook Task using Powershell OutlookTools Module.

 

Hi,

Good Evening everyone.

In my previous posts we have created new, contacts, calendar meeting using Powershell and now it is time to create outlook tasks using Powershell.

I have converted all functions to the module and you can download the module from my Github repository.

“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

1

You can see a new cmdlet New-OutlookTask  (basically function is there).

Like previous functions the New-OutlookTask is based on Outlook.Application com object too. While writing this module i was wondering that how amazing and simple Powershell is.

I think one day, i will write a post about how awesome Powershell is ;o).

Okey, Our Module is imported and now lets see some examples of creating a Outlook tasks using our New-OutlookTask function in OutlookTools Module.

Example : 1

Lets create a simplest task, with just a subject using the –Subject Parameter,

New-OutlookTask -Subject "Going to visit Alice in wonderland"

14-08-2013 1

and you can see that task name “Going to visit Alice in Wonderland” appeared in the Outlook task list.

14-08-2013 2

Example: 2

Lets create a task with some extra notes using parameter -Notes

New-OutlookTask -Subject "Visit Captain Jack Sparrow" -Notes " He lives near Caribbean"

 

 

14-08-2013 3

You can see that , task is appeared in the Outlook and it has the note which we defined using –Notes parameter.

14-08-2013 4

Example: 3

Let’s create a task with high importance and with a specific start date.

New-OutlookTask -Subject "Metting with Mr. Harrry Potter" -Importance 2 -StartDate "08/15/2013 19:00 "

 

 14-08-2013 5

You can see that. this task has the start date and High Priority and mentioned in above function.

14-08-2013 6

Example: 4

Lets create  a simple task with no reminders.

New-OutlookTask -Subject "Meeting with Tony" -Notes "ask him about Startreak" -EnableReminder $false

 

 14-08-2013 7

You can see that in this task, there is no reminder is set.

14-08-2013 8

Example: 5

Lets create a final task with start date, due date and with reminder set.

New-OutlookTask -Subject "Search for Avengers" -Notes "I goona find them" -Importance 2 -StartDate "08/15/2013"-DueDate "08/19/2013" -ReminderTime "08/17/2013 10:30"

 

 

14-08-2013 9

You can see that , everything is set :) .

14-08-2013 10

I hope you will enjoy it.

“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