PowerCLI: Scriptkit

From VI-Toolkit
Revision as of 10:19, 6 March 2014 by Wila (talk | contribs) (Created page with "=== ScriptKit === author: Rynardt Spies ==== Description ==== Rynardt has started working with Powershell and PowerCLI and as a seasoned C++ developer he's already being pret...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


author: Rynardt Spies


Rynardt has started working with Powershell and PowerCLI and as a seasoned C++ developer he's already being pretty productive with this. He has been kind enough to start sharing his work in a library that he calls "ScriptKit". You are welcome to send him scripts to add to the library so that it becomes an easy bases to start looking for scripts for more people.

Currently he has divided up his library in the following two categories, at the time of writing it already contains the following scripts.


Creates up to two vMotion interfaces and configures them with details specified in a CSV file. For a single interface, comment out the entire vmk2 section.


Add hosts in cluster to a specified AD Domain.


This script is used to set the maximum remote console sessions allowed on all virtual machines found in the servers.txt file. This is required by many financial industry to prevent more than one concurrent remote console session to a virtual machine in order to an administrator of a VM being shadowed remotely.


Set the ShellTimeOut Setting for all hosts in the specified cluster(s) and restarts the ESXiShell Service. Changes require the SSHShell TSM service to be restarted


Updates the MTU size for specified VMKERNEL virtual nics (vmk0, vmk1, vmk2, etc.)

Horizon View

Updates the External IP address refernece in VMware Horizon View to match the current public IP address of the security server.

Run this script on the View Connection Server


Report on the HBA Link Speed, HBA Queue Depth, HBA Topology of each ESXi host.


Report on the Management and vMotion IP Addresses (vmk)


Report on the ShellTimeOut Setting for all hosts in specified clusters/DC objects


Script to return all datastores seen in vCenter as well as their capacity, used space and free space.


Report WWN Numbers for hosts specified in $clusters


Report the current port group configuration as well as the discovered CDP information.

Handy for comparing actual portgroup config with physical upstream switch config


Report the configured NTP Servers as well as the Configured Syslog server


Return all CD and Floppy Devices for each VM, including connection state


Reports the Name, vCenter, Datacenter, Cluster, Host and Folder for every virtual machine visible within the PowerCLI session. Also works when connected to multiple VI servers.

Output is saved to a CSV file as specified in $ReportFile

Helpful in large environments with many vCenter servers.



Rynardt's blog article introducing the scriptkit and asking for help. http://www.virtualvcp.com/news/197-contribute-to-my-powercli-script-repository-and-help-the-community

Repository: https://github.com/rynardtspies/ScriptKit