SCRIPT LIST

This page will give you a direct link to all scripts and useful one-liners I have written.

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

133 thoughts on “SCRIPT LIST

  1. Rajesh

    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”

  2. Pingback: Sys admin skills are always growing--try APIs and scripts next

  3. Pingback: Embrace the “New Normal” | Street2Clouds

  4. Selwin S

    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?

  5. Mahesh

    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.

  6. Praveen Kumar

    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.

  7. Mounika

    I have list of my Vms in the txt file, Please help how to pull those server details only to make IPs static

  8. Mounika

    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”
    }

    }

    }

  9. Sandeep

    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.

  10. Pingback: VMware – Powershell – ITuDA

  11. Adam

    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

  12. Pingback: 101 Free VMware Tools

  13. durgaprasad467

    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

  14. sunilsun90

    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

  15. Razzi Medina

    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

  16. Ashi Sunnam

    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.

  17. bklynjames

    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.

  18. DomV

    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

  19. ray

    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.

  20. lio

    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!!!!!!

  21. Thiyagarajan

    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

  22. Abhijeet Gurjar

    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

  23. TariqAli

    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.

  24. Mike

    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!!

  25. coudry Sebastien

    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.

  26. vineeth

    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

  27. PereDM

    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

  28. Pingback: Powercli script referance page Dane Miljkovic

  29. Dale

    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

  30. Abhijeet Mali

    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

  31. Dale

    Brox,

    Sorry, I did not see your response come in. Thanks for the syntax. I will check it out in the morning.

  32. Raj

    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!!

  33. Brox

    @Dale, Try Get-VMHost | Foreach {$_.Name; $_ | Get-VM}

    $_.Name shows the ESX Hosts name then $_ | Get-VM shows all VMs under that host.

  34. Dale

    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

  35. Anoop

    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,

  36. Lynn Carpenter

    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

  37. Nick Colyer

    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

  38. blackhorse

    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?

  39. Chris Turner

    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?

  40. fragar

    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.

  41. Wallander

    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,

  42. pookatini

    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

  43. pookatini

    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…)

  44. CyberIDentity

    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

  45. Mithilesh

    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

  46. Sean

    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

  47. mmason

    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?

  48. a raza

    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

  49. Alan Post author

    You will need to use the Invoke-VMScript or use Get-WMIObject to call the machines and check for this data,

  50. Hitesh

    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..:)

  51. Raul

    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

  52. Kris

    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,

  53. Pete L

    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.

  54. Sean

    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.

  55. ranjit

    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

  56. ranjit

    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

  57. Pingback: PowerCLI: Mass VM Portgroup Change « Virtu-Al

  58. keshava

    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

  59. Dale S

    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.

  60. Dale S

    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?

  61. Virtu-Al

    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.

  62. John R

    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

  63. Chris

    Hi,

    Does anyone have a ecoshell script to remove hidden network adapters from a VM?

    Thanks,

    C

  64. sanjai

    Alan,

    Need an one-liner to find out the Path Selection policy (MRU / Fixed) for esx 3.5 (cluster level / datacenter level)

    Any suggestions?

  65. Pingback: A couple of new things

  66. Andrew McMorris

    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?

  67. Andrew Richardson

    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!

  68. Bond West

    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

  69. Srini

    Sorry in my previous message missed couple of things.

    Iam looking for script which can pull stats as mentioned earlier for every 30mins intervals.

  70. Srini

    Hi

    Iam look for a script which can pull cpu & memory stats for VM including max, min & AVG.

    Thanks
    Srini

  71. cemal

    Hi Alan
    I need a script to change of solaris guest ‘s ip adrress . Can you help me ?

    Thanks in advance

  72. Grog

    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

  73. Gus Chavira

    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.

  74. Pingback: PowerCLI / PowerShell Scripts | harmes.de

  75. Pingback: vSphere Documenters « Roshan Ratnayake – IT Architect

  76. Pingback: VMware PowerCLI: Auch für Perl SDK-ler

  77. Brian

    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.

  78. Pingback: Bookmarks for March 6th through March 24th | Savage Nomads

  79. Suresh Kumar

    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.

  80. Pingback: Scripts

  81. Peter

    Hi…
    This is a great repository!

    I’m looking for script to show the build version of VMware tools into vm machine….

  82. Ken

    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.

  83. Jason Boche

    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.

  84. Pingback: VMware vSphere - виртуализация ЦОД » Список скриптов PowerShell (VMware vSphere PowerCLI).

  85. Jason Boche

    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.

  86. George

    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.

  87. q

    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!

  88. Pingback: Alan Renouf – Script List « powercli.co.uk

  89. Virtu-Al

    @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

  90. gareth

    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

  91. Michael

    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.

  92. Michael

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.