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
- PowerGUI (old 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 |
PowerGUI (old 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 |
Hi, I need a script to export the VM names and time source, which are configured with host time configuration. I mean ” Synchronize guest time with host”
Pingback: Sys admin skills are always growing--try APIs and scripts next
Pingback: Embrace the “New Normal” | Street2Clouds
I suggest you read the help for new-vm
I’m trying to deploy a VM in esxi 6.5 from powerCLI tool using a .vmdk file! Do powercli has built-in commands to do that?
Dear Virtu-Al, You are the driving force for many part time Sysadmin, Architects like me.. Thanks, you scripts have saved hundreds of hours for me.
Hi Alan,
I am new to PowerCli and need help.
Is there anyway we can check CRC errors on vmnic, apart from the esxcli network command.
I am looking for a script or if it is available somewhere in any logs so that we can configure that error in vROPS.
We have more than 500 hosts and we want to check how many of them are having CRC errors, just to avoid any outage. We faced a recent issue where one VM stopped pinging because there was lot of CRC errors on one of the vmnic.
In our environent we have mixed hardware. Few of them are having 4 uplink whereas few of them are having 2.
I have list of my Vms in the txt file, Please help how to pull those server details only to make IPs static
I have a script to change the Private IP address from dynamic to static. But i need to do it only few Vms. How to call those details into my script
Below is the script
$Nics = Get-AzNetworkInterface
foreach($Nic in $Nics)
{
write-host “$($Nic.Name)” -ForegroundColor Cyan
$IPcount = ($NIC.ipconfigurations.PrivateIpAllocationMethod).Length
for($i = 0;$i -lt $IPcount;$i++)
{
if($NIC.ipconfigurations[$i].PrivateIpAllocationMethod -eq “Dynamic”)
{
$NIC.ipconfigurations[$i].PrivateIpAllocationMethod = “Static”
Set-AzNetworkInterface -Networkinterface $Nic | Out-Null
Write-Host “$($NIC.ipconfigurations[$i].Name) has changed to static”
}
}
}
I need help to create a script:
Register a template
On a host
From a datastore
To a folder
Get-help new-vm -examples
Hello ,
Can you help me in getting a script for cloning a VM ,
hi team,
Is there any script to generate replictaion health report of Virtual machine which are in cluster. it should have replication health status and last replication stats.
Pingback: VMware – Powershell – ITuDA
Hi,
Anyone got a script to see if there virtual machines on datastores that aren’t in the inventory for vCenter? For example maybe someone has only deleted the inventory of a VM instead of doing a delete from disk
Pingback: 101 Free VMware Tools
Hi Alan,
Can you help me with script to identify VMs with Vmtools “Out-Of-Date” and update the tools on the VMs without reboot.
Thanks
Prasad
Yes, look at PowerVRA, PowerLI (google them) and PowerCLI does VRops
Hi All
Is there is any PowerCLI Script or any WebServices call to configure the Vrealize Automation, vrealize login sight , vrealize operation manager . with out manually
There are a lot of ways to do this and most are very simple – see https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007069 for a good script from VMWare themselves.
Is there a script I can use to query a ESX hosts 5.5 network adapters to see which VLANs it can detect on the wire that are not configured in the Network config of the host. Basically I want to see which VLANs it can detect or see? Thanks
Get-VM | Get-VMGuest | Select VmName,OSFullName
Hi all,
I wrote a script that shuts down the VMs in the VCenter and modifies the vmx file to disable the hot-plug capability and restarts the VMs. The script was successfully tested in the test environment but weird things happened when I attempted to run it in the production environment.
The script recalls a .txt file with the list of all VMs in it. In this scenario I attempted to run the script on one VM in production environment before implementing it across all the VMs.
1:03 PM- Ran the script in production environment, VM was rebooted, verified from the VM that hot-plug capability was disabled
1:37 PM – alerted that the VM was rebooted again. VM logs show the Ethernet controller was ejected.
For whatever reason, the script rebooted the machine again and ejected the Ethernet controller approximately 30-40 minutes later.
Please advise as to what could be wrong here.
Hi All, looking for a script to remove all the storage from a cluster. Unmount and detach or if there is an easier way. The cluster is going away and the storage teams wants to unpresent it.
looking for a script that would list datastorecluster name, all vm’s using this datastorecluster name and the cluster that the vm’s reside.
output example
-datastorecluster “name”
-vm “name1” “vmclustername1”
-vm “name2” “vmclustername2”
etc
thanks
Write a script that will prompt user to enter user name then it will get
computer name at where user logged in on the entire network.
hi
any script for SRM
i need to change “final power state”
thx
WHATS THE FILE NAME WHERE I NEED TO SAVE COMPUTERNAME
great PS1
but i have small issue i try to upgrade it and make host list menu to choose from
but when i press the host num his ignore my request and choose other host
what i do wrong
$ExportFilePath = “C:\HostVMNicsInfo.csv”
$PuttyUser = “root”
$PuttyPwd = “HarelEsx”
$Plink = “C:\putty\plink.exe”
$PlinkOptions = ” -v -pw $PuttyPwd”
$RCommand0 = “ethtool -i “
$ESXHosts = Get-VMHost | Sort Name
$i = 0
write-host -foregroundcolor Green `n “Please Choose Host”
foreach ($ESXHosts in $ESXHosts){
write-host -foregroundcolor Cyan “$i – $ESXHosts”
$i++
}
$ESXHost = read-host `n “Enter the Host number you want to check”
$cluster = $ESXHosts[$ESXHost]
$Report = @()
ForEach ($ESXHost in $ESXHosts) {
$pNics = $ESXHost | Get-VMHostNetworkAdapter -physical
ForEach ($pNic in $pNics) {
$Message = “”
$HostInfo = {} | Select HostName,ESXVersion,Cluster,pNic,DriverName,DriverVersion,DriverFirmware
$HostInfo.HostName = $ESXHost.Name
$HostInfo.ESXVersion = $ESXHost.Version
$HostInfo.Cluster = (Get-Cluster -VMHost $ESXHost.Name).Name
$HostInfo.pNic = $pNic.Name
Write-Host “Connecting to: ” $ESXHost.Name -ForegroundColor Green
$Command = $Plink + ” ” + $PlinkOptions + ” ” + $PuttyUser + “@” + $ESXHost.Name + ” ” + $RCommand0 + ” ” + $pNic.Name
$Message = Invoke-Expression -command $command
$HostInfo.DriverName = ($Message[0] -split “driver: “)[1]
$HostInfo.DriverVersion = ($Message[1] -split “version: “)[1]
$HostInfo.DriverFirmware = ($Message[2] -split “firmware-version: “)[1]
$Report += $HostInfo
}
}
$Report = $Report | Sort-Object HostName
IF ($Report -ne “”) {
$Report | Export-Csv $ExportFilePath -NoTypeInformation
}
Invoke-Item $ExportFilePath
HELP!!!!!!
Replace the service name.
######################################################################################
# Service status report
# ————————–
# This is to take report of particular service status in multiple server
#
# ———————————————————————————
# Author:
# Input server list in C:\Systems.txt and Output will be saved in C:\Report.csv
######################################################################################
function Cluster-service {
Process{
Trap {
Continue}
$pingresult = gwmi -Query “select * from win32_pingstatus where address = ‘$_'” -ErrorAction Stop
$obj = New-Object psobject
$obj | Add-Member noteproperty ServerName $_
if($pingresult.statuscode -eq 0) {
Trap {
Continue}
$service = gwmi win32_service -ComputerName $_ -filter “name = ‘clussvc'” -ErrorAction Stop
$obj | Add-Member Noteproperty ServiceName ($service.name)
$obj | Add-Member Noteproperty Status ($service.status)
$obj | Add-Member Noteproperty Reachable Reachable
}
else {
$obj | Add-Member noteproperty Reachable Notreachable
}
write-output $obj
}
}
gc C:\serverlist.txt | Cluster-service | ft ServerName,ServiceName,Status,Reachable -AutoSize | Out-File C:\Report.csv
Hi Team,
I am looking for the script which will provide me the current set of permissions on the following set of files and folders withing ESX/ESXi hosts.I need to create this report every month for all the hosts in my environment.The task is manual and time consuming too.Can any one help me with the script which will help me to accomplish this.
The list of files and folders are as follows.
/etc/passwd /etc/passwd /etc/shadow /etc/shadow- /etc/group /etc/login.defs /etc/profile /etc/bashrc /etc/sudoers /usr/sbin/esxcfg-auth /usr/sbin/esxcfg-firewall /usr/sbin/esxcfg-route /usr/sbin/esxcfg-vmknic /usr/sbin/esxcfg-vswitch /etc/krb5.conf /etc/krb.realms /etc/krb.conf /etc/ldap.conf /etc/openldap/ldap.conf /etc/grub.conf /boot/grub/grub.conf /etc/nsswitch.conf /etc/resolv.conf /etc/pam.d/crond /etc/pam.d/login /etc/pam.d/other /etc/pam.d/passwd /etc/pam.d/remote /etc/pam.d/sshd /etc/pam.d/su /etc/pam.d/sudo /etc/pam.d/system-auth /etc/pam.d/vmware-authd /etc/ssh/ssh_config /etc/ssh/sshd_config /etc/snmp/snmpd.conf /etc/vmware/config /etc/vmware/vmware-cim-config.xml /etc/cron.d /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly /etc/crontab /etc/securetty /etc/syslog.conf
Awaiting your reply.
Abhi
Hi Alan,
i was wondering if you had wrriten any script that can check a VM’s CPU usage and advise if it is over sized and recommand number of vCPU. from my understanding more vCPU doesnt always coutn towards high performance. anyone welcome to comment.
First off, Im really glad I found this site. You and other contributors rock! I have looked through the scripts and found many that will save us a lot of time and trouble. On that note, do you know of a way to script finding all VM’s that were moved and powered back on due to a total host/network/storage failure? Currently, VMWare support can’t tell us how to get that info.
Thanks!!
Hello, is that EMC me redirect your blog to get information.
I have a infrasctructure with a vCenter 4 esx and two storage arrays (one on a production site and one that is a replica of the first through RecoverPoint)
I wonder if it was possible to script the automatic reinvotory my VM’s on the Bay of replication.
I would have had to happen.
Desinventory of VM production
Reinventory the VM’s on the LUN of SNAP on the Bay of replication.
tool to check a lun is multi mapped or not to all vm in a cluster
hello alan
i want a script or tool to check how many vms are mapped to a perticular lun and which vm is not mapped to that particular lun in a cluster i want out put has mapps or .xls file
Alan, what’s up with the unsubscribe option, i can’t do that 🙁
How can I submit a new plugin?
Hello…I am looking to move a bunch of VMs from cluster to cluster using an NFS swing disk and need to determine VMs allotted and using high memory but with little disk I/O. 8 node clusters with approx. 750 VMs….don’t want to have to go through them manually.
Thanks, PereDM
Pingback: Powercli script referance page Dane Miljkovic
Brox,
I ran the script you provided, but it did not return anything. Sorry to be such a bother. Could it be an access issue?
Dale
Hi,
i’m beginner in Scripting, can you asisst me in having a script which shows all the VM’s which are powered off on each esx host and date they are powered off. and everything can be extracted to .csv form.
Please assist.
Regards
Abhijeet mali
Brox,
Sorry, I did not see your response come in. Thanks for the syntax. I will check it out in the morning.
Hi,
Thanks for the scripts these are very helpful.
I need some scripts where i can get cpu usage,memory usage, for both the esx hosts & vm in my environment.
I need to Generate monthly reports for the capacity.
Thanks in advance for your help!!
@Dale, Try Get-VMHost | Foreach {$_.Name; $_ | Get-VM}
$_.Name shows the ESX Hosts name then $_ | Get-VM shows all VMs under that host.
Can anyone tell me why the following statement results in no VMHost name being returned? I have a complete script that provides all the information I need, but I would like to add the ESX host name and I am finding it very difficult to do. I only have limited access to the ESX as I am a server SA not an ESX manager.
get-vm | select VMHost, Name
Hi,
Can some one help me with the steps to work with this scripts
Hi,
Can some one help me with the steps to work with this scripts.
Hi,
is it possible to create a VM where the cpu/proc speed can be off specified value or cpu cycles can be fixed by the user?
Thanks in advance,
Is there a script that will tell me which vm’s are running SQL services? I have about 300 vm’s and I don’t know how many are running SQL server in one form or another.
Thanks for the great scripts!
Lynn
Any script getting guest OS on VM’s?
Does anyone have the updated version of this with all of the corrections already in it for vsphere 5/Powercli 5.
If so please can you e-mail it to me.
Thanks,
Nick
I need to change IP address, Hostname and gateway of single or 10 number of Linux VMs.
Does anyone have a script to get this done?
I have over 500 esx servers and need to find out how many of them are configured to automatically startup its Vms when the hosts boots up. Does anyone have a script that will pull this information down quickly rather than me checking every host individually?
alan, great site!
installed the virtu-al.net powerpack. right-clicking on the node does not give us the ability to import the pack. at this time i cannot collapse the built-in queries.
Hi,
IS there anyway by which I can find out the Disk Read and Write Latency on the VM disks?
No the disks on the ESX, but Disks on the VM.
Get-Stat -Entity USB-SSWEB -stat virtualDisk.totalWriteLatency.average
tried this nothing came
Regards,
Absolutely, as long as they are accessible to each other over the network.
Would it be possible from VM(guest Machine) that on which ESX server it is resides on?
For any non “i” version of ESX I recommend the ESX Healthcheck shell script (https://sourceforge.net/projects/esxhealthscript/). This wont work on ESXi due to the lack of a service console. In this case I would recommend the PowerShell based health script from Al (http://www.virtu-al.net/featured-scripts/vcheck/) or the health check script from Ivo Beerens (http://www.ivobeerens.nl/2009/01/06/new-version-of-the-powershell-healthcheck-script-released/).
ESX 4.1, and actually either is fine, which ever works best for you. Also, I do have some specifics as I trying to get the following info for the hosts in case of a need to rebuild from kickstart:
switch configurations – uplinks, settings, speeds, switch names, vlan tags, port groups and port connections (Virtual Machine, vs Service Console vs VMKernel)
NAS and SAN mounts and names
Service Console IP addresses
ESX version, build #
Thank in advance for your assistance
What version of ESX and do you want PowerShell or a Linux shell script?
Script request: Is there an existing script that will pull all necessary ESX host config info in case of a failure? (ie, network info, vswitches, NAS mounts, etc…)
Is it possible to produce a one liner that shows multiple vmnic MAC addresses for guests and hosts? I have this so far, but I am still learning.
Get-VM | Get-NetworkAdapter | Select Parent, MacAddress | Export-Csv D:\CLI\File.csv
Thanks in advance.
CB
Hi Alan,
I am looking for Powershell script to check VM first boot device is Network or local storage.
any help will be greatly appriciated.
-Mithilesh
Get-VM | Select VMHost, Name | Sort VMHost, Name
I am looking for a way to list each esx host and all the guest located on the host. I think i have seen it before but not sure. Is there a script out there for that?
Thanks
Sean
Alan gotta say this is going to be an awesome addition to our vCenter monitoring. Thank you!
I do have a quick question. I would LOVE to get the web page output of vCheck as an addon to vCenter so when our service desk is in the VIC they could add this page as an addon and pull it up without leaving the VIC. Any ideas on how to accomplish this?
Can you please tell me how to get a report contaning all VMs configuration information (e.g. # of CPU, Memory, host name, os info, sevice park)..any script which goes to word/excel
Great Site!!!
You will need to use the Invoke-VMScript or use Get-WMIObject to call the machines and check for this data,
Hi All,
First of all I would like to thank for this grt repository of scripts..
I am really new to powershell and VM administration and really want to learn a lot and hope to get great help from you guys and thanks to you all in advance.
I m trying to generate a report for last logons on virtual machines,script in which i can specify the login dates, i need this script to get VMs which has not been used for a month..
Please let me know if there are other options to get these details.
Thanks alot in advance..:)
I am using vcheck5. I want to combind two scripts 1. Vm’s & Templates with inconsistant folder names and 2. vm guest disk sizes. Or to put it more directly. i want the second script to tell me which lun the VM resides with all the other information it already gives me. Thanks
I i wonder if you could help me, I have VI with 10 ESX 4.1 U1 hosting around 100 VMs. I’
m looking for a script that can pull perfrmance report/charts (graphical) on all VMs for last 30 days.
Thanks,
Suggestion:
Is it possible to list all of the os types and platform? Example
Datastore ABC Has 10 Win2k8R2 and 5 Windows2k3
Datastore XYZ Has 2 Windows2008Std, 4 Windows 2008Enterprise.
Again just an example.
I have two main VMware environments, back-end and customer facing and I have vKernel monitoring on the customer facing environment. Each day I get a cool report, Capacity Monitor Datastore Statistics Report, which gives me some useful information (total space, allocated space, free space, commited %, utilized %). My experience with powershell is related to Exchange and not VMware so all the commands available are new and I am just learning them. So far I have not found a way to get this same type of information (very useful with thin provisioned disks) using powershell.
I see that get-datastore will give me some of the information but nothing related to the ‘over’ allocated space of each datastore (i.e. 2 TB lun with 2.7 TB allocated and 750 GB free). Could you point in the direction to where I can find this information/command(s) in powershell? Thank you for your time.
Hi Alan,
I have manage to write the script for manage thin provisioned datastores.
script will migrate vms from datastore which doesn’t have free space to free datastore.
it will take care that destination datastore will have enough free space.
Your site help a lot for this… thanks
ranjit, see this link…
http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=4387
Hello Alan, thanks for your scripts ..
we have thin provisioned all the VMs and now we have set alarms on datastores..which shows us alert if datastore is used beyond 75%.
could you provide us acript whcih can look for datastores used more than 75% and identify the datastores which has free space and move the VM to that datastore
thanks ,
Ranjit
Pingback: PowerCLI: Mass VM Portgroup Change « Virtu-Al
Hopefully the end of April – Don’t hold me to that though !
Thanks,
for the farst replay,
and i am waiting for ur book,, when can hold it on my hand?
Thanks, you need to look at the remove-snapshot cmdlet, there are some good examples in the help.
Hi Virtu-al i happy that you are feeding knowledge to geeks on scripts and congrats for your work,
please tell me how to remove old snapshots from the vm’s through the scripts
I would like to see both, but would take just the datastores if I had to. Either way I am going to need to correlate what VMs are mapped to what RDM devices.
When you say SAN LUN do you mean datastore and RDM or just datastores?
I need to export the I/O and MB/s for each connected SAN LUN in XML or CSV. Is there a way to do this?
You can set a manual mac address on the vm but I don’t think you can use the same pool as what is used as the current mac, maybe an adjustment to the vmx file and a re-register would do it but I would need to check. Then you could automate that.
Hello Alan Do you know if there is a script which will
create a new virtual NIC with the same MAC as the existing NIC. We
have an issue where we have hundreds of VMs with v4 hardware and we
will be upgrading to v7 but want to create new VMXNet3 NICs on each
VM. The MAC address needs to be the same as we reserve IP addresses
in DHCP based on MAC address. Thanks John
Hi, Does anyone have a script to list all VM’s within a
folder. Thanks Guido
Hi,
Does anyone have a ecoshell script to remove hidden network adapters from a VM?
Thanks,
C
Alan,
Need an one-liner to find out the Path Selection policy (MRU / Fixed) for esx 3.5 (cluster level / datacenter level)
Any suggestions?
Pingback: A couple of new things
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?
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!
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
Sorry in my previous message missed couple of things.
Iam looking for script which can pull stats as mentioned earlier for every 30mins intervals.
Hi
Iam look for a script which can pull cpu & memory stats for VM including max, min & AVG.
Thanks
Srini
Hi Alan
I need a script to change of solaris guest ‘s ip adrress . Can you help me ?
Thanks in advance
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
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.
Pingback: PowerCLI / PowerShell Scripts | harmes.de
Pingback: vSphere Documenters « Roshan Ratnayake – IT Architect
Pingback: VMware PowerCLI: Auch für Perl SDK-ler
Brian,
Have you seen Luc’s great post on this ?
http://lucd.info/?p=1935
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.
Pingback: Bookmarks for March 6th through March 24th | Savage Nomads
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.
Pingback: Scripts
Hi…
This is a great repository!
I’m looking for script to show the build version of VMware tools into vm machine….
@Ken
I have now 😉
http://www.virtu-al.net/2009/12/20/powercli-copying-advanced-host-configuration/
@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
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.
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.
Pingback: VMware vSphere - виртуализация ЦОД » Список скриптов PowerShell (VMware vSphere PowerCLI).
@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
I am new to this powercli can you give me more info how to use it thanks
@Jason Boche
You ask and I supply 😉 http://www.virtu-al.net/2009/10/19/powercli-mass-vm-portgroup-change/
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.
@George
I would love to but cant find a nice ‘non dependant on 3rd party tool’ way of doing it.
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.
@Mike La Spina
Thanks Mike
@q
Have you tried this… http://communities.vmware.com/message/1105904#1105904 you can always use this function to do….
Get-folder | Get-Permissions
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!
Awesome collection! Thanks for sharing your knowledge Alan.
Regards,
Mike
Pingback: Alan Renouf – Script List « powercli.co.uk
@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
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
@bjorn bats
Ummmm, its coming, other stuff keeps getting in the way !
where is the list then ?
@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
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.
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
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.