Virtually everything is poshable
Script List
This page will give you a direct link to all scripts and useful one-liners I have written.
- Getting Started
- Virtual Machines
- ESX Hosts
- Licensing
- Datastore’s
- Networking
- Reporting
- Lessons
- Cluster
- Snapshots
- Security
- Others
- VESI
Getting Started
|
Name |
Brief Description |
Link |
|
Icomasoft PowerCLI Reference Card |
PowerCLI reference card | Click Here |
| VI Toolkit Quick Reference Guide | Quick reference guide of the VI Toolkit cmdlets | Click Here |
| PowerShell Get-Member fun | An example of using Get-Member | Click Here |
| Getting Started with the VI Toolkit | A guide on how to get started | Click Here |
Virtual Machines
|
Name |
Brief Description |
Link |
| More HAL Information | List VM/Num vCPU/HAL/OS Version/Service Pack | Click Here |
|
last 10 VMs created and removed |
List all VMs created or deleted over a period of time or last x number | Click Here |
| Local stored VMs | List all VM’s located on local storage | Click Here |
| More one-Liner power | Set the CPU and Memory limits on multiple VMs Find a VM with a specific Mac Address |
Click Here |
| Stats One-Liner | List each VM and the average CPU/Memory over x amount of days | Click Here |
| More One Liners | List number of VM’s per resource pool and list Host, Cluster, Number of VMs and number of templates |
Click Here |
| Folder Name Mismatch | Lists all VM’s which are stored in a folder not the same as their name | Click Here |
| How many VMs ? | Lists how many VM’s were on each host | Click Here |
| Storage VMotion – The PowerCLI way | Shows how to VMotion and SVMotion VMs using PowerCLI | Click Here |
| PowerCLI on steroids – Custom attributes | Exporting and importing Custom attributes | Click Here |
| One-Liner: VM Guest Disk Sizes | List all VM’s and their disk sizes | Click Here |
| One-Liner: Correct HAL ? | List the number of vCPU’s assigned to a VM and the type of HAL installed in the O/S | Click Here |
| Setting MMU for your VMs | Set MMU for multiple VMs | Click Here |
| Reservations / Limits and Shares | Export your Reservations limits and Shares | Click Here |
| List VM’s with RDM | List all VMs which have an RDM | Click Here |
| Who deleted my VM ? | A script to find the culprit ! Reading the VC database | Click Here |
| Checking CPU Affinity | A Script that lists each VM and the CPU they are tied to. | Click Here |
ESX Hosts
|
Name |
Brief Description |
Link |
| Checking Host Network Information | List all ESX Host Service console and VMotion network information | Click Here |
|
Number of vCPUs in a cluster |
detail the number of vCPU’s on a host and in a cluster | Click Here |
| Reading host log files | How to read a hosts log files and use these in your scripts | Click Here |
| Processor Types | List each of your hosts and a detailed CPU type | Click Here |
| Do you have the time ? | List each hosts NTP settings and if the service is running | Click Here |
| Host Hardware one-liner | Details the hosts hardware details | Click Here |
| vProfiles | A Script to automatically configure your hosts from an existing host | Click Here |
| More One Liners | List number of VM’s per resource pool and list Host, Cluster, Number of VMs and number of templates |
Click Here |
| Provision ESX Hosts through PowerShell | A Link to a script by SCampbell | Click Here |
| Getting VMware Host Physical Nic Speeds | A script to list all Nics and their speeds | Click Here |
| Rescan all hosts for new storage | Rescan all hosts for new Storage | Click Here |
Licensing
|
Name |
Brief Description |
Link |
| License Server Scripts | How to list the licensed features on each host and also monitor the license service | Click Here |
Datastores
|
Name |
Brief Description |
Link |
| How Many VMs on your Datastores ? | Lists the number of VMs on each Datastore | Click Here |
|
Mass provision datastore’s |
add multiple datastore’s from a csv file | Click Here |
| Local stored VMs | List all VM’s located on local storage | Click Here |
Networking
|
Name |
Brief Description |
Link |
| One-Liners Checking Host Network Information | List Host PG/IP/Subnet/Console/DNS/Device information | Click Here |
| More one-Liner power | Find a VM with a specific Mac Address | Click Here |
| vProfiles | A GUI Script to automatically configure your hosts vSwitches and Port Groups from an existing host | Click Here |
| Easy vSwitch & PortGroup Setup | Copy existing vSwitches and PortGroups from an existing Host | Click Here |
| Lesson 3 – Networking | Creation of vSwitches | Click Here |
| Lesson 4 – PortGroups | Creation of PortGroups | Click Here |
| More Network Info | Various network information | Click Here |
| Detailed VMware Host Network Information | Network information including CDP info | Click Here |
| Getting VMware Host Physical Nic Speeds | A script to list all Nics and their speeds | Click Here |
| Mass VM PortGroup Change | Change the portgroup for multiple VMs | Click Here |
| Host Network Config | Lists all the needed information to perform this best practice analysis | Click Here |
Reporting
|
Name |
Brief Description |
Link |
| vCheck 3.1 | Fixes for vCheck 3 to fix slight issues | Click Here |
| vCheck (Daily Report V3) | Version 3 of the Daily Report, or now known as vCheck | Click Here |
| Daily Report V2 | Enhanced Error and issues report, listing vital information for a daily check of your entire VI | Click Here |
| Daily Report V1 | Error and issues report, listing vital information for a daily check of your entire VI | Click Here |
| vDiagram – Draw your VI with one script | Draw your Virtual Infrastructure in Visio | Click Here |
| Mapping your VI using Netmap | Draw your Infrastructure in a netmap style | Click Here |
| Checking Logs | Checking the vmkernel log for issues | Click Here |
| Quick Stats from VMware for reports | Shows how to create quick charts on your VI | Click Here |
| Exporting VI Info into MS Word | A script which creates a word document with various VMware information | Click Here |
Lessons
|
Name |
Brief Description |
Link |
|
Lesson 1 – Time Source |
Setting up a host, adding a time source | Click Here |
| Lesson 2 – Service and Firewall Configuration | Service and firewall configuration | Click Here |
| Lesson 3 – Networking | Creation of vSwitches | Click Here |
| Lesson 4 – PortGroups | Creation of PortGroups | Click Here |
| Using the VI APIs from Powershell | Excellent guide by Luc on how to get started with the VI API’s | Click Here |
| My First Powershell | Export information into Excel | Click Here |
Cluster
|
Name |
Brief Description |
Link |
| HA Slot Size Information | Detail the slot information for each Cluster | Click Here |
|
Number of vCPUs in a cluster |
detail the number of vCPU’s on a host and in a cluster | Click Here |
| More One Liners | List number of VM’s per resource pool and list Host, Cluster, Number of VMs and number of templates |
Click Here |
| Check Cluster Configurations | A great script by Hugo which compares the cluster configuration | Click Here |
Snapshots
|
Name |
Brief Description |
Link |
| SnapReminder | Automatically emails the creator of a snapshot after x amount of days | Click Here |
Security
|
Name |
Brief Description |
Link |
| vSphere Permissions export and import – Part 1 | Walkthrough of how to export and import permissions | Click Here |
| vSphere Permissions export and import – Part 2 | Walkthrough of how to export and import permissions | Click Here |
| Lesson 2 – Service and Firewall Configuration | Service and firewall configuration | Click Here |
| Primal Forms Example (Virtual Center Log) | A great script by FatBeard showulng how to use a GUI to read the VCenter Logs | Click Here |
| Checking Logs | Checking the vmkernel log for issues | Click Here |
Others
|
Name |
Brief Description |
Link |
| vTip – A VMware Expert updating your VI | Message of the day updated by Jason Boche | Click Here |
|
Running a PowerCLI Scheduled Task |
Details how to run a PowerCLI script as a scheduled task | Click Here |
| vProfiles | A Script to automatically configure your hosts from an existing host | Click Here |
| Extra fields in the VI Client | Excellent script by Hugo which adds information back into the Virtual Infrastructure | Click Here |
| Check Active Directory Latency Script | Check Active Directory Latency | Click Here |
| Change DNS and WINS on multiple servers | Change DNS and WINS on multiple servers | Click Here |
| Powershell Citrix License Alerts | Reading the Citrix licenses from the Web interface and reporting | Click Here |
| Server/Workstation Audit script | Audit multiple servers or workstations and produce a nice html output using this script. | Click Here |
VESI
|
Name |
Brief Description |
Link |
| The VESI 1.2 – Get it Now | List of the 2.1 Features | Click Here |
| HA Slot Size Information | Detail the slot information for each Cluster | Click Here |
- Alan Renouf – Script List « powercli.co.uk
- VMware vSphere – виртуализация ЦОД » Список скриптов PowerShell (VMware vSphere PowerCLI).
- Scripts
- Bookmarks for March 6th through March 24th | Savage Nomads
- VMware PowerCLI: Auch für Perl SDK-ler
- vSphere Documenters « Roshan Ratnayake – IT Architect
- PowerCLI / PowerShell Scripts | harmes.de
- A couple of new things







(3)
(13)
(0)
about 1 year ago
Do you know of an equivalent in powercli to the esxcfg-firewall -o command? I am new to powercli and have not found a way to open a port. Thanks for your time.
about 1 year ago
Did you see this post I did earlier ? http://www.virtu-al.net/2009/04/14/customisation-lesson-2-–-service-and-firewall-configuration/ Hopefully it will cover what you want
about 1 year ago
Thanks for the fast response and helpful link. But, I am still looking to replace esxcfg-firewall -o 1311,tcp,in,OpenManageRequest command with a powercli cmdlet.
about 1 year ago
@Michael
Sorry looks like I was wrong, check this link, there is a way to mass do this but not using the PowerCLI cmdlets independantly….
http://communities.vmware.com/message/1085547#1085547
about 1 year ago
where is the list then ?
about 1 year ago
@bjorn bats
Ummmm, its coming, other stuff keeps getting in the way !
about 1 year ago
Hi there,
I wonder if you could help. I am really new to powershell on VMware so feel free to be gentle. I am trying to work out the powershell command to show the last power on event for a host and also the memory size for the host as well.
I have about 200 hosts I need to check this on so if I could use PS I would laughing!
Thanks in advance
Gareth
about 1 year ago
@gareth
Added to the blog for reference:
To csv file use this:
get-cluster “My Cluster” | Get-VM | Get-View | Select Name, @{N=”BootTime”;E={$_.Summary.runtime.boottime}} | Export-Csv c:\temp\boot.csv
To a text file use this:
get-cluster “Production Cluster 3″ | Get-VM | Get-View | Select Name, @{N=”BootTime”;E={$_.Summary.runtime.boottime}} | out-file c:\temp\boot.txt
about 12 months ago
Awesome collection! Thanks for sharing your knowledge Alan.
Regards,
Mike
about 11 months ago
This is a great repository! Is there a script to get a list of which roles are applied to which groups on which folders? Thanks!
about 11 months ago
@q
Have you tried this… http://communities.vmware.com/message/1105904#1105904 you can always use this function to do….
Get-folder | Get-Permissions
about 11 months ago
@Mike La Spina
Thanks Mike
about 11 months ago
Great Stuff!! I’ve used the report.ps1 script for a while now. Are there any plans to remove dependencies on the Office Web Components? MS has stated those are depricated.
about 11 months ago
@George
I would love to but cant find a nice ‘non dependant on 3rd party tool’ way of doing it.
about 10 months ago
Script Request: Need a script to change the portgroup connection in each VM from X to Y. ie. I have 100 VMs that need to move to a new VLAN (portgroup). Editing the settings of each VM and updating the portgroup connection would be tedious.
about 10 months ago
@Jason Boche
http://www.virtu-al.net/2009/10/19/powercli-mass-vm-portgroup-change/
You ask and I supply
about 10 months ago
I am new to this powercli can you give me more info how to use it thanks
about 10 months ago
@tony
Sure, have you checked out the getting started links on this site and also a great book is “Managing vmware virtual infrastructure with Powershell” by Hal Rottenburg, there is also the PowerCLI forum and FAQ here: http://communities.vmware.com/community/vmtn/vsphere/automationtools/windows_toolkit;jsessionid=3F9B08F3F055E22FE877ED351B04CD7A?view=overview&numResults=15
about 9 months ago
Script Request: Search a datastore for all templates and register them in vCenter. Since Templates ownership cannot be transferred to another host, rebuilding a host which owns templates requires us to manually re-register the templates. This is a pain. I have been harping on VMware to fix this and make Templates portable like VMs. Check your email – Happy Holidays.
about 8 months ago
Hey Alan,
Do you have a script stashed anywhere that will sync ESX advanced settings across all hosts in a cluster? I’m looking around for one before I write it myself so I don’t have to reinvent the wheel.
about 8 months ago
@Jason Boche
Im sure you have already seen it but for the purposes of others looking, Luc has a great script which does that.. http://lucd.info/?p=1103
about 8 months ago
@Ken
I have now
http://www.virtu-al.net/2009/12/20/powercli-copying-advanced-host-configuration/
about 6 months ago
Hi…
This is a great repository!
I’m looking for script to show the build version of VMware tools into vm machine….
about 5 months ago
Hi Alan,
Thanks for this awesome repository of scripts.
REQUEST: Please give us one script to collect patch information from the esx hosts in the VC and export it to csv or HTML.
about 5 months ago
Alan, do you know of a script that would show me a list of VMs on a datastore but specifically relating to thin provisioned VMs? I am trying to find a way that I can tell the amount of space used and over provisioned…. Does that make sense.
about 5 months ago
Brian,
Have you seen Luc’s great post on this ?
http://lucd.info/?p=1935
about 4 months ago
Looking for a script similar to others I have seen but that captures all VMs but what resource pool they are registered under. Creating a new vCenter install. Have powershell script to recreate my resource pool organization under clusters but want to place the VMS by name reference back under those cluster’s resource pool structures.
about 4 months ago
Alan,
First let me say wonderful job on the vCheck 5 script. It is awesome!!!
I wanted to see if you had worked on anything related to creating patch compliance reports for ESX hosts? It would be great to either create a standalone script or add it to vCheck as an option.
Thanks,
Marc
about 4 months ago
Hi Alan
I need a script to change of solaris guest ‘s ip adrress . Can you help me ?
Thanks in advance
about 4 months ago
Hi
Iam look for a script which can pull cpu & memory stats for VM including max, min & AVG.
Thanks
Srini
about 4 months ago
Sorry in my previous message missed couple of things.
Iam looking for script which can pull stats as mentioned earlier for every 30mins intervals.
about 3 months ago
Script Request: Search a datastore for all templates and register them in vCenter. Since Templates ownership cannot be transferred to another host, rebuilding a host which owns templates requires us to manually re-register the templates. This is a pain. I have been harping on VMware to fix this and make Templates portable like VMs. Check your email – Happy Holidays.
+1
about 2 months ago
Hi Alan,
Is it possible to script the iSCSI initiator nic binding? Usually you’d use the “esxcli swiscsi” command but I can’t find any version of this for PowerCLI.
Thanks!
about 1 month ago
Bit of an idea, trying to put together a script that will show VM’s by the folder structure in vCenter and let you choose what info to show, power state, memory, cpu etc..
Any thoughts?