Save Time With PowerCLI

Post on 24-May-2015

2.262 views 2 download

Tags:

Transcript of Save Time With PowerCLI

How To Save Your Time With PowerCLIJonathan Medd

Pick the right management tool for you or the situation

Do You Manage Any Of These Technologies?

Write your own script or function help, for you or someone else

They will thank you, and you will be pleased one day that you did it too

Help Demo

Digitally Sign Your Scripts

Save time and costly mistakes by helping prevent unauthorised changesMost IDEs will sign the script for you

Be Green, Create Advanced Functions as Reusable Code

Advanced Functions - Features

•Add –Confirm, -WhatIf capabilities•Parameter Attributes• Mandatory, Parameter Sets, Accept Pipeline Input, Help Message, Validation

Advanced Functions - Demo

Competition Time – PowerCLI Book Giveaway Where is PowerCLI Guru Alan Renouf originally from?

• France

• Netherlands

• Jersey

• Outer Space

Modules Make Distributing Your Code EasierVS

What is a PowerShell Module?

• A collection of files containing functions, scripts etc and possibly other files such as the manifest to make it more professional

• Stored within a folder as a subfolder of the Modules location. Can be found via $env:PSModulePath

• Contents made accessible to the user via the Import-Module cmdlet

Why Bother with a PowerShell Module?

• Makes sharing of groups of functions and scripts easy• Simple XCOPY style deployment of the module folder either internally or

publishing to an external website• Make your commonly used functions available to yourself without ‘Profile

Bloat’ – they are available as and when you need them from a module

Make Your First Module

• Create two functions• Save them into a *.psm1 file to the module

folder• Import them for use into your session• Go!

Make Your First Module - Demo

PowerCLIBook Module - Demo

If you borrow it, make sure you test it!

Share back your own scripts / solutions. You know how good it was when you found something useful, give someone else that same experience.

Good places to start borrowing

Virtu-Al.netLucD.infoVMware PowerCLI Community Site

Borrowed Examples

PowerGUI VMware PowerPack

Use in combination with VMware Community PowerPack to kick start your PowerCLI scripting

PowerGUI Quick Overview

Automate Deployment of ESXi

At a minimum use PowerCLI to create a standard host config

For bonus points use additional technologies to automate further:• Kickstart• Host Profiles• AutoDeploy

In Jeffrey We Trust