After doing ESX upgrade you might encounter with host profile compliance failure.
eg:
Expected user input parameters missing. Check the host customization settings for the host.
To solve this, you need to update the answer file for the host profile with the username and password that used to join the host to the domain. The host does not store this locally so after the upgrade you need to do this again.
Go to Home > Host Profiles > Hosts and Clusters
Right click on the host with the non compliant, Update Answer File.
Once done, check the compliance again.
Showing posts with label vm. Show all posts
Showing posts with label vm. Show all posts
Wednesday, May 7, 2014
Host Profile Compliant Failures
Labels:
host profile,
troubleshooting,
vm,
vmware
Tuesday, April 22, 2014
Get esx host for each vm using powercli
Here's a one liner to get the hostname of the vm is currently running on.
PowerCLI C:\cq> get-vm <VM-NAME> | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
replace the VM-NAME with your VM.
for multiple VM, use comma (,)
eg:
get-vm vm01, vm02, vm03 | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
PowerCLI C:\cq> get-vm <VM-NAME> | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
replace the VM-NAME with your VM.
for multiple VM, use comma (,)
eg:
get-vm vm01, vm02, vm03 | select Name, @{N="Cluster";E={get-cluster -vm $_ }}, @{N="ESX Host";E={get-vmhost -VM $_}}
Tuesday, November 26, 2013
Determining which user removed or deleted a virtual machine
quite a common question for vm sysadmin, may i know who deleted the vm?
answer in the link.
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2005478
answer in the link.
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2005478
To determine which user removed or deleted a virtual machine, check the vCenter Server Events tab for the host or cluster on which the virtual machine resided.
If the Events tab does not provide a record far back enough, you can export user events.
To export user events:
- With the vSphere client connected to the vCenter Server, click File > Export > Export Events.
- Ensure the type User is selected.
- Choose a time range using the From and To dropdowns.
- Click OK.
- Open the text file that is created, navigate to the end of the file, and search backward for the name of the virtual machine. The username of the user that removed or deleted the virtual machine displays.
Tuesday, August 13, 2013
Keeping VMTools ALWAYS up to date
Dear sysadmins out there, how do you guys keep the VMtools and virtual hardware up to date, all the time? Less than 20 VM would still be manageable, but hundreds of them, with some are in live production environment is not an easy task.
1st update:
One liner to get the VMtool and virtual hardware version status:
Get-VM | select Name,Version,@{N="Tools Status";E={$_.Guest.Extensiondata.ToolsVersionStatus}}
2nd Update:
One liner is not good enough, my plan is to align the VMtool upgrade during patching windows (subject to approval)
first, script to get the details.
The task should be split into two parts:
1) Get all the VMtools up to date
2) Upgrade virtual hardware
This would require at least 2 downtimes. First downtime is a reboot once VMtools installed. 2nd downtime is to power off the VM and do the virtual hardware upgrade. Note that virtual hardware should only be upgraded once the VMtools is updated or you might lose the network setting on that VM.
There is an option to keep the VMtools checked during each power cycle. Found a link to get that massed using powerCLI (http://damiankarlson.com/2011/01/23/managing-vmware-tools-advanced-options-powercli/) but for the first round it could be the manual option.
1st update:
One liner to get the VMtool and virtual hardware version status:
Get-VM | select Name,Version,@{N="Tools Status";E={$_.Guest.Extensiondata.ToolsVersionStatus}}
2nd Update:
One liner is not good enough, my plan is to align the VMtool upgrade during patching windows (subject to approval)
first, script to get the details.
Function Get-myPatchingReport {
#sample get-vm | % { Get-myPatchingReport $_ } | ft -a
param ($VM)
$report = @()
$row = "" | select Name, OS, Version, ToolStatus
$v = get-vm $VM | get-view
$get = get-vm $VM
$row.Name = $VM
$row.OS = $v.Guest.GuestFullName
$row.Version = $get.Version
$row.ToolStatus = $get.Guest.Extensiondata.ToolsVersionStatus
$report += $row
$report
}
export the report to csv/xls and compare to the patching master list for the exact window. Since some VMs are still running Win2k3, they will not be in patching list. Thus, the Guest OS that is captured from the script.
Going to update this (again) later after I got some live data.
*edit: script was badly coded it will create large temp files and took very long time to complete if you have large environment. will work for about 20-30 vm. else just export the list from vcenter.
Going to update this (again) later after I got some live data.
*edit: script was badly coded it will create large temp files and took very long time to complete if you have large environment. will work for about 20-30 vm. else just export the list from vcenter.
Wednesday, February 20, 2013
Custom VM report, output to CSV
Note: VC, Template and Description is for manual entry, they don't have any data :)
function Get-myReport {
#sample: get-content test.txt | %{ Get-myReport $_ } | export-csv C:\testout.csv -notypeinformation
param ($VM)
$report = @()
$row = "" | select VC, Cluster, Name, Template, ResourcePool, NumCPU, RAMSizeGB, D_DriveSizeGB, VLAN, Application, BusinessUnit, Category, Support, Description
$v = get-vm $VM
$VLAN = get-virtualportgroup -vm $VM
$app = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "Application"}
$unit = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "business unit"}
$category = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "category"}
$support = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "support"}
$row.Cluster = $v.vmhost.parent.name
$row.Name = $VM
$row.ResourcePool = $v.resourcepool.name
$row.NumCPU = $v.NumCpu
$row.RAMSizeGB = $v.MemoryMB / 1024
$row.D_DriveSizeGB = ""
$row.VLAN = $VLAN.name
$row.Application = $app.value
$row.BusinessUnit = $unit.value
$row.Category = $category.value
$row.Support = $support.value
$DriveD = Get-mVMdriveD $VM
$row.D_DriveSizeGB = $DriveD.Size
$report += $row
$report
}
function Get-mVMdriveD {
param ($VM)
gwmi -query "SELECT Caption, Size FROM win32_logicaldisk WHERE DriveType=3" -computer $VM | where-object { $_.Caption -eq "D:" } | select-object @{Name="Size"; Expression={"{0:N0}" -f ($_.Size/1GB)}}
}
function Get-myReport {
#sample: get-content test.txt | %{ Get-myReport $_ } | export-csv C:\testout.csv -notypeinformation
param ($VM)
$report = @()
$row = "" | select VC, Cluster, Name, Template, ResourcePool, NumCPU, RAMSizeGB, D_DriveSizeGB, VLAN, Application, BusinessUnit, Category, Support, Description
$v = get-vm $VM
$VLAN = get-virtualportgroup -vm $VM
$app = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "Application"}
$unit = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "business unit"}
$category = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "category"}
$support = get-vm -Name $VM | get-annotation | where-object {$_.Name -eq "support"}
$row.Cluster = $v.vmhost.parent.name
$row.Name = $VM
$row.ResourcePool = $v.resourcepool.name
$row.NumCPU = $v.NumCpu
$row.RAMSizeGB = $v.MemoryMB / 1024
$row.D_DriveSizeGB = ""
$row.VLAN = $VLAN.name
$row.Application = $app.value
$row.BusinessUnit = $unit.value
$row.Category = $category.value
$row.Support = $support.value
$DriveD = Get-mVMdriveD $VM
$row.D_DriveSizeGB = $DriveD.Size
$report += $row
$report
}
function Get-mVMdriveD {
param ($VM)
gwmi -query "SELECT Caption, Size FROM win32_logicaldisk WHERE DriveType=3" -computer $VM | where-object { $_.Caption -eq "D:" } | select-object @{Name="Size"; Expression={"{0:N0}" -f ($_.Size/1GB)}}
}
Sunday, September 9, 2012
Active memory or consumed memory
Referring to older post about getting the numbers of memory and CPU usage HERE, lets go deeper into the memory part.
The script collect the usage of memory active, instead of memory consumed. It is the amount of memory that is actively used, as estimated by VMkernel based on recently touched memory pages (REF).
That is not a very good indicator if you're doing a VM resizing plan, or chargeback. To get a better view, use consumed memory counter instead. This is closest guess of what is the amount of memory used by the guest VM.
Or, get Veeam One monitor ;-)
Read more about memory counters
The script collect the usage of memory active, instead of memory consumed. It is the amount of memory that is actively used, as estimated by VMkernel based on recently touched memory pages (REF).
That is not a very good indicator if you're doing a VM resizing plan, or chargeback. To get a better view, use consumed memory counter instead. This is closest guess of what is the amount of memory used by the guest VM.
Or, get Veeam One monitor ;-)
Read more about memory counters
Labels:
memory,
troubleshooting,
veeam,
vm,
vmware
Wednesday, August 22, 2012
Getting VM utilization history using PowerCLI
I found this awesome powerCLI script that help to get VM's utilization history.
Change the line "$start = (get-date).AddDays(-1)" accordingly to set how many days of history you want.
Original link :- http://communities.vmware.com/message/1784833#1784833
$report = @() $metrics = "cpu.usage.average","mem.active.average" $vms = Get-Vm | where {$_.PowerState -eq "PoweredOn"} $start = (get-date).AddDays(-1) Get-Stat -Entity ($vms) -start $start -stat $metrics | ` Group-Object -Property EntityId | %{ $row = ""| Select VmName, Timestamp, vCPU, MinCpu,AvgCpu,MaxCpu,MemAlloc,MinMem,AvgMem,MaxMem $row.VmName = $_.Group[0].Entity.Name $row.Timestamp = ($_.Group | Sort-Object -Property Timestamp)[0].Timestamp $row.vCPU = $_.Group[0].Entity.NumCpu $cpuStat = $_.Group | where {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average $row.MinCpu = "{0:f2}" -f ($cpuStat.Minimum) $row.AvgCpu = "{0:f2}" -f ($cpuStat.Average) $row.MaxCpu = "{0:f2}" -f ($cpuStat.Maximum) $row.MemAlloc = $_.Group[0].Entity.MemoryMB $memStat = $_.Group | where {$_.MetricId -eq "mem.active.average"} | Measure-Object -Property Value -Minimum -Maximum -Average $row.MinMem = "{0:f2}" -f ($memStat.Minimum) $row.AvgMem = "{0:f2}" -f ($memStat.Average) $row.MaxMem = "{0:f2}" -f ($memStat.Maximum) $report += $row} $report | Export-Csv "C:\VM-stats.csv" -NoTypeInformation -UseCulture
Change the line "$start = (get-date).AddDays(-1)" accordingly to set how many days of history you want.
Original link :- http://communities.vmware.com/message/1784833#1784833
Subscribe to:
Posts (Atom)