Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • PowerCLI Cookbook
  • Toc
  • feedback
PowerCLI Cookbook

PowerCLI Cookbook

By : Philip Brandon Sellers
4.8 (4)
close
PowerCLI Cookbook

PowerCLI Cookbook

4.8 (4)
By: Philip Brandon Sellers

Overview of this book

If you are a virtualization professional who wants to unleash the power of automation and combat the complexity of sprawling virtual environments, this book is ideal for you. This book will enhance your skills of administering VMware vSphere and vCloud Director with PowerCLI.
Table of Contents (13 chapters)
close
12
Index

Creating a function to automatically remediate snapshots


Creating ad hoc commands is very useful in PowerCLI, but there are times and situations where you find yourself repeatedly doing the same tasks, or where your series of cmdlets becomes long for complex tasks. The next step is to create a PowerCLI function that can be reused and repeated. In the case of snapshot management, the function can be initiated from a single command and will run through your established procedure. This makes it easier to do your work.

You can take and store the function in a .ps1 file that can be referenced easily. While functions are really useful, they must be defined in each new PowerCLI window, so storing them in a file eases that process.

It is also important to understand scope when working with functions. Each PowerShell or PowerCLI window is a scope in itself. Each function is given its own scope as well, which means that each function can use the same variable names, and changing data in the function...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete