Archivos Mensuales: julio 2016

Scripts Vmware PowerCLI

Buscar MAC dentro de un Cluster

#====================================================================#
#   SCRIPT:        Find_VM_by_MAC_address_menu.ps1                   #
#   FUNCTION:      Find VM (+ adapter) by MAC address with easy menu #
#   OWNER:         Sander Daems                                      #
#   CREATED:       11/01/2011                                        #
#   MODIFIED:      11/01/2011                                        #
#   VERSION:       v.1.0                                             #
#====================================================================#
#   CHANGELOG:                                                       #
#                                                                    #
#    v.1.0                                                           #
#    - Created script;                                               #
#                                                                    #
#====================================================================#
#   HOST - CUSTOM DEFINITIONS                                        #
#====================================================================#
Write-Host "Let's find that damn address" -foregroundcolor green
#====================================================================#
$cluster = read-host "Select Cluster name"
$macaddress = read-host "Select MAC Address to find"
#====================================================================#
#   Script                                                           #
#====================================================================#
Get-Cluster $cluster | Get-VM | Get-NetworkAdapter | Where-Object {$_.MacAddress -eq "$macaddress"} | Format-List -Property *
#====================================================================#
Gracias A , link original http://blog.vmpros.nl/2011/11/01/vmware-easy-menu-to-find-vm-adapter-by-mac-address/
Actualizar Vmware-tools
#Enter your vCenter Host below
$vcenter= "your_vcenter_server"
################################
#Load the VMware Powershell Module
Add-PSsnapinVMware.VimAutomation.Core
#Connect to the vCenter server defined above. Ignore certificate errors
Connect-VIServer$vcenter-wa0
#Get the folder name from the user. Update all VM's if blank
$folder= Read-Host"Which folder would you like to update? (Leave blank to update all VM's)"
#Check if the user entered a folder. If a folder was provided return only the VM's for that folder
If($folder)
{
Write-Host"Updating VM's in $folder"
#Get all VM's for a specified folder and return only their names
$virtualmachines= Get-Folder$folder| Get-VM| select-expandpropertyName
}
#Else if the user left the folder blank, get all VM's
Else
{
Write-Host"Updating all VM's"
#Get all VM's in the vCenter and return only their names
$virtualmachines= Get-VM| select-expandpropertyName
}
#Perform the following for each VM returned
ForEach($vmin $virtualmachines)
{
Write-Host"Updating VMware Tools on $VM"
#Update VMware tools without rebooting the VM
Update-Tools$vm-NoReboot
}
Gracias a  Matt Bradford en http://www.vmspot.com/using-powershell-to-update-vmware-tools-on-vms-2/