Virtual Machine Technology: VMware, ESX, ESXi, vCenter, VirtualCenter, Lab Manager, Stage Manager, VDI, VMware View, Citrix, XEN, Microsoft Hyper-V, Virtual Iron, VirtualBox, Vmware Workstation, Fusion, Parallells, SAN Storage, EMC, Dell, Equallogic, Celerra, CX, Clariion
Search This Blog
Friday, April 6, 2012
An Easy way to get VMhost UUID
There's a an easy way than going through all that.
Get-VMhost | Get-View | % { $_.hardware.systeminfo.uuid }
That's it. If you want to get fancy and have a need for speed (if you have many VMhosts):
Get-View -ViewType HostSystem -Propert Name, hardware.systeminfo -Filter @{"Name"="VMHostNameHere" } | % { $_.hardware.systeminfo.uuid }
If you want to get even fancier and return the host name with the UUID, here's a little trick using SELECT:
Get-View -ViewType HostSystem -Propert Name, hardware.systeminfo -Filter @{"Name"="VMHostNameHere" } | Select Name, @{N="UUID" ; E={$_.hardware.systeminfo.uuid } }
Notice the "N=" and "E=" clauses? N means NAME and E means expression.
No offense to http://thephuck.com/scripts/script-to-pull-host-uuid-for-vmware-powercli/comment-page-1/ . Visit it, It's a nice blog.
Wednesday, January 18, 2012
a VERY LONG onliner to get Cisco CDP from a VMware dvSwitch (or vSwitch)
This Oneliner is broken into mutiple lines for ease of use. But it can be condensed to ONE LINE. Yehaw!
Get-view -ViewType HostSystem -Filter @{"Name"="$VMhost"} -Property ConfigManager.NetworkSystem, Name | sort name | % { $n=$_.name ; $objConfigManager_NetworkSystem = get-view $_.ConfigManager.NetworkSystem ; $objConfigManager_NetworkSystem | % { $_.NetworkInfo } | % { $_.Pnic } | SELECT @{N="Name"; E={$n} } , device, pci, mac, @{N="PortID" ; E= { $objConfigManager_NetworkSystem.QueryNetworkHint($_.Device) | % { $_.ConnectedSwitchPort.PortID } } }, @{N="DevID" ; E= { $objConfigManager_NetworkSystem.QueryNetworkHint($_.Device) | % { $_.ConnectedSwitchPort.DevID } } } | ? { $_.Device -match "vmnic" }
}
Output Example:
| Name | Device | PCI | MAC | PortID | DeviceID | |
| esxhstesx01.us.ano.net | vmnic0 | 01:00.0 | 00:34:84:5d:75:a4 | GigabitEthernet2/0/9 | C3750x.phx.az.anon.com | |
| esxhstesx01.us.ano.net | vmnic1 | 01:00.1 | 00:23:44:5d:75:a6 | GigabitEthernet1/0/11 | C3750x.phx.az.anon.com | |
| esxhstesx01.us.ano.net | vmnic2 | 04:00.0 | 00:43:33:90:77:78 | GigabitEthernet2/0/11 | C3750x.phx.az.anon.com | |
| esxhstesx01.us.ano.net | vmnic3 | 04:00.1 | 00:77:33:90:77:79 | GigabitEthernet1/0/9 | C3750x.phx.az.anon.com |
Tuesday, November 1, 2011
One liner to get VMNIC and PCI adapter positions
Get-vmhost $VMhost | % {$x=$_; $x| get-view | % { get-view $_.ConfigManager.NetworkSystem } | % { $_.NetworkInfo } | % { $_.Pnic } | Select @{N="VMhost"; E={$x} } , device, pci, mac }
Friday, September 9, 2011
Automated Script to re-register VM
Wednesday, August 3, 2011
Nine (9) new vSphere 5 new white papers
VMware 9 new vSphere 5 new white papers. Other sites post links to sites with links. Since that bugs me, below are the direct URL to the white paper PDF files.
| 1. VMware vSphere Storage Appliance Technical Whitepaper | http://www.vmware.com/files/pdf/techpaper/VMware-vSphere-Storage-Appliance-Technical-Whitepaper.pdf |
| 2. What's New in VMware Data Recovery 2.0 Technical Whitepaper | http://www.vmware.com/files/pdf/techpaper/Whats-New-VMware-Data-Recovery-20-Technical-Whitepaper.pdf |
| 3. What's New in VMware vCenter Site Recovery Manager 5.0 Technical Whitepaper | |
| 4. What's New in VMware vCloud Director 1.5 Technical Whitepaper | |
| 5. What's New in VMware vSphere 5.0 Availability | |
| 6. What's New in VMware vSphere 5.0 Performance | |
| 7. What's New in VMware vSphere 5.0 Storage | |
| 8. What's New in VMware vSphere 5.0 Networking | |
| 9. What's New in VMware vSphere 5.0 Platform |
Wednesday, July 13, 2011
Get-FT.ps1 - A script to get VM's running FT (Fault Tolerance)
$ft = get-view -ViewType VirtualMachine -filter @{"Config.FtInfo.Role"="1|2|3"}
$ft | select Name, @{N="Role" ; E={$_.Config.FtInfo.Role } }, @{N="RecordReplayState" ; E={$_.Runtime.RecordReplayState } }, @{N="FaultToleranceState" ; E={$_.Runtime.FaultToleranceState} }
Save this to an ANSI text file and run it against your connected vCenter.
Enjoy!
Tuesday, April 26, 2011
ESXi SNMP Configuration
VMware Remote CLI is imperative (but not required if you want to use a different method). RCLI should not be confused with PowerCLI. They are different tools and do different things. RCLI contains remote management batch files which use PERL to connect to the VMware API.
Now, Install VMawre Remote CLI. The vCenter server is convenient but your local desktop works too. Once installed, you'll get a command prompt shortcut. If you don't see it, it will be under the start/programs/Vmware/Vmware vSphere CLI. Run it.
Under the directory which RCLI launches, there's a BIN directory. CD BIN to get to that directory. Now the RCLI scripts can execute.
The vicfg-snmp.pl -s displays existing settings. BTW, vicfg-snmp.pl = esxcfg-snmp.pl. They are the same.
vicfg-snmp.pl --username root --password yourpw --server esxihost-s
The vicfg-snmp.pl -D disables SNMP.
vicfg-snmp.pl --username root --password yourpw --server esxihost-D
The vicfg-snmp.pl -t sets the community string and SNMP target server.
vicfg-snmp.pl --username root --password yourpw --server esxihost -t %srvsnmp%/MY-RO -communities MY-RO
The vicfg-snmp.pl -D enables SNMP.
vicfg-snmp.pl --username root --password yourpw --server esxihost