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 Jump to search

ScriptKit

author: Rynardt Spies

Description

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.

Configuring
 create_vmotion_vmk.ps1 	

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.

 host_auth_addto_ad_domain.ps1 	

Add hosts in cluster to a specified AD Domain.

 set_vm_max_console_sessions.ps1 	

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_vmhost_shell_timeout.ps1 	

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

 set_vmk_mtu.ps1 	

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

Horizon View
      set_viewSecurity_extIP.ps1

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

Reporting
 report_HBAConfig.ps1 	

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

 report_MgmtvMotionIPs.ps1 	

Report on the Management and vMotion IP Addresses (vmk)

 report_ShellTimeOut.ps1 	

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

 report_datastore_space.ps1 	

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

 report_host_wwn.ps1 	

Report WWN Numbers for hosts specified in $clusters

 report_netConf_CDP.ps1 	

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_ntp_syslog.ps1 	

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

 report_vm_attached_media.ps1 	

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

 report_vm_list.ps1

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.

Usage

Location

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