Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PowerCLI Cookbook

You're reading from   PowerCLI Cookbook Over 75 step-by-step recipes to put PowerCLI into action for efficient administration of your virtual environment

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781784393724
Length 274 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Philip Brandon Sellers Philip Brandon Sellers
Author Profile Icon Philip Brandon Sellers
Philip Brandon Sellers
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Configuring the Basic Settings of an ESXi Host with PowerCLI 2. Configuring vCenter and Computing Clusters FREE CHAPTER 3. Managing Virtual Machines 4. Working with Datastores and Datastore Clusters 5. Creating and Managing Snapshots 6. Managing Resource Pools, Reservations, and Limits for Virtual Machines 7. Creating Custom Reports and Notifications for vSphere 8. Performing ESXCLI and in-guest Commands from PowerCLI 9. Managing DRS and Affinity Groups using PowerCLI 10. Working with vCloud Director from PowerCLI A. Setting up and Configuring vCloud Director Index

Creating a new user in an organization using Views


In this recipe, since PowerCLI does not yet have a New-CIUser cmdlet, you will write a function to handle this process. The function requires to have the correct rights to create organizational users, but it will allow you to create users from PowerCLI without having to switch back to the web console. The code and function are based on a blog post from Alan Renouf, a product manager who focuses on automation frameworks and CLI at VMware.

Getting ready

To begin this recipe, open PowerShell ISE and set up a VMware PowerCLI environment by adding the PSSnapIn cmdlet, VMware.VimAutomation.Core.

How to do it…

In order to create a new user in an organization using Views, perform the following steps:

  1. In PowerShell ISE, set up a basic function definition for New-CIUser:

    Function New-CIUser {
    
  2. Next, add your synopsis and help text to the function:

    <#
    .SYNOPSIS
      Creates a new user in a vCloud installation
    .DESCRIPTION
      Creates a new user account in...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image