E4F's Posts

Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent, Name, DiskType, ScsiCanonicalName, DeviceName | FL Here is the output: Parent                                    ... See more...
Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent, Name, DiskType, ScsiCanonicalName, DeviceName | FL Here is the output: Parent                                            : Server1 Name                                             : Hard disk 3 DiskType                                       : RawPhysical ScsiCanonicalName                    : naa.600601600ae12800507484a92399e011 DeviceName                                 : vml.0200000000600601600ae12800507484a92399e011565241494420 Parent                                            : Server1 Name                                             : Hard disk 4 DiskType                                       : RawPhysical ScsiCanonicalName                    : naa.600601600ae1280092f135662399e011 DeviceName                                 : vml.0200010000600601600ae1280092f135662399e011565241494420 Is it possible to set the ScsiCanonicalName so to the name of the VM and RDM, like the following: Parent                                            : Server1 Name                                             : Hard disk 3 DiskType                                       : RawPhysical ScsiCanonicalName                    : Server1-RDM DeviceName                                 : vml.0200000000600601600ae12800507484a92399e011565241494420
Is it possible to script creating a cluster that sets the following? Check HA and DRS Un-Check Enable Host Monitoring Select Enable EVC for Intel Hosts Select Intel Xeon Core i7 from the dr... See more...
Is it possible to script creating a cluster that sets the following? Check HA and DRS Un-Check Enable Host Monitoring Select Enable EVC for Intel Hosts Select Intel Xeon Core i7 from the drop down
Oh yeah, I forgot about that one.  Thanks
Robert, Will this also move vmx files if they are in the datastore?
How would you script migrating all VMDK's from one datastore to another datastore.
Thanks!
Is there a way to map the datastore canonical name to friendly name?  I can't seem to find a way to do this and can't find anything on the web to show me how either.  Any ideas? E4F
I was using that to upload the chart to an API and forgot to take it out of the code that I pasted.  Sorry.
# load the appropriate assemblies [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualizat... See more...
# load the appropriate assemblies [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization") # Create a chart $Chart = New-object System.Windows.Forms.DataVisualization.Charting.Chart $Chart.Width = 1150 $Chart.Height = 500 $Chart.Left = 20 $Chart.Top = 30 # Create a chartarea to draw on and add to chart $ChartArea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea $Chart.ChartAreas.Add($ChartArea) # Add title and axes labels [void]$Chart.Titles.Add((Get-Date -Format D))  $ChartArea.AxisX.Interval = 1 $ChartArea.AxisX.LabelStyle.Angle = -45 $ChartArea.AxisY.Title = "CPU Usage %" # Add data to chart #--------------------------------------------------------------------------------------- Add-PSSnapin vRanger.API.PowerShell -ErrorAction SilentlyContinue  Add-PSSnapin vmware.VimAutomation.core -ErrorAction SilentlyContinue $NumReportDays = 7 $Collection = @() get-vmhost | % { $avgCPU = ($_ | Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddDays($NumReportDays * -1) | Measure-Object Value -Average | Select-Object -expandproperty average) $Record = new-Object -typename System.Object $Record | Add-Member -memberType noteProperty -name Host -Value $_.Name $Record | Add-Member -memberType noteProperty -name CPU -Value ([System.Math]::Round($avgCPU,1)) $Collection += $Record } $objColl = $Collection | sort-object CPU -descending | select-object Host, CPU -first 10 $H = @(Foreach ($item in $objColl) {      $item.Host }) $C = @(Foreach ($item in $objColl) {      $item.CPU }) [void]$Chart.Series.Add("Data") $Chart.Series["Data"].Points.DataBindXY($H, $C) #--------------------------------------------------------------------------------------- # Make bars into 3d cylinders $Chart.Series["Data"]["DrawingStyle"] = "Cylinder" # Save the Chart $Chart.SaveImage("$pwd\Test.jpg",[System.Windows.Forms.DataVisualization.Charting.ChartImageFormat]::JPEG)
That did it, Thanks!
Sorry, Full Script $String = "" get-cluster | Sort-Object Name | % { $avgCPU = 0 get-vmhost -location $_.name | % {   $avgCPU = $avgCPU + ($_ | Get-Stat -Stat cpu.usage.average -Start ... See more...
Sorry, Full Script $String = "" get-cluster | Sort-Object Name | % { $avgCPU = 0 get-vmhost -location $_.name | % {   $avgCPU = $avgCPU + ($_ | Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddHours(-168) -IntervalMins 720 -MaxSamples (168) | Measure-Object Value -Average | Select-Object -expandproperty average)   $avgArray += ,@($_.Name, $avgCPU)   $_.Name   $avgCPU = 0 } } $Date = Get-Date $String += ("$Date" + "`r`n") $String += "`r`n" $String += "CPU Utilization (%)`r`n" $String += "" $CPUArray = $avgArray | sort-object @{Expression={$_[1]}; Descending=$true} $range = 0..9 For($i=0; $i -lt $range.Count; $i++) {     $String += $CPUArray[$i][0] + " " + $CPUArray[$i][1] + "%`r`n" } ConvertTo-Html -Body $String > $File
Any ideas why these escape characters are not working?  The output is all on one line and is ignoring the `r`n for some reason. $File ="D:\Scripts\Server\HostResourceReport.htm" $Date = G... See more...
Any ideas why these escape characters are not working?  The output is all on one line and is ignoring the `r`n for some reason. $File ="D:\Scripts\Server\HostResourceReport.htm" $Date = Get-Date $String += ("$Date" + "`r`n") $String += "`r`n" $String += "CPU Utilization (%)`r`n" $String += "" $CPUArray = $avgArray | sort-object @{Expression={$_[1]}; Descending=$true} $range = 0..9 For($i=0; $i -lt $range.Count; $i++) {     $String += $CPUArray[$i][0] + " " + $CPUArray[$i][1] + "%`r`n" } ConvertTo-Html -Body $String > $File
Is it possible to pull the CPU Ready stats on a per ESX Host basis?
That did it
Yes I do
I am not able to get CPU stats from my ESX hosts using the following command.  Has anyone seen this before. get-vmhost -name Server101| Get-Stat -Stat cpu.usage.average -Start (Get-Date).Add... See more...
I am not able to get CPU stats from my ESX hosts using the following command.  Has anyone seen this before. get-vmhost -name Server101| Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddHours(-168) -IntevalMins 720 -MaxSamples (14) Here is my output MetricId                Timestamp                          Value Unit     Instance --------                ---------                          ----- ----     -------- cpu.usage.average       10/26/2011 8:00:00 AM                  0 % cpu.usage.average       10/26/2011 6:00:00 AM                  0 % cpu.usage.average       10/26/2011 4:00:00 AM                  0 % cpu.usage.average       10/26/2011 2:00:00 AM                  0 % cpu.usage.average       10/26/2011 12:00:00 AM                 0 % cpu.usage.average       10/25/2011 10:00:00 PM                 0 % cpu.usage.average       10/25/2011 8:00:00 PM                  0 % cpu.usage.average       10/25/2011 6:00:00 PM                  0 % cpu.usage.average       10/25/2011 4:00:00 PM                  0 % cpu.usage.average       10/25/2011 2:00:00 PM                  0 % cpu.usage.average       10/25/2011 12:00:00 PM                 0 % cpu.usage.average       10/25/2011 10:00:00 AM                 0 % cpu.usage.average       10/25/2011 8:00:00 AM                  0 % cpu.usage.average       10/25/2011 6:00:00 AM                  0 %
Thanks for all of your help!!!  This is very close to what I am trying to do. The last column should be 3.26%*144GB*hosts (Amount Under Threshold * 147456) * Number Of ESX Hosts Thi... See more...
Thanks for all of your help!!!  This is very close to what I am trying to do. The last column should be 3.26%*144GB*hosts (Amount Under Threshold * 147456) * Number Of ESX Hosts This will get the number of ESX hosts Foreach ($CLUS in Get-Cluster | Sort-Object Name ) {$VMHosts = Get-CLuster $CLUS | Get-VMHost; ($VMhosts.count * 147456) / 1024 }
Here is what I am getting now Memory Usage (%) ------------ 67.27 69 63.13 65.57 45.24 58.49 69.32 70.41 68.34 58.75 25.56 36.9 5.48 2.04 6.07 Here is what I am trying to do... See more...
Here is what I am getting now Memory Usage (%) ------------ 67.27 69 63.13 65.57 45.24 58.49 69.32 70.41 68.34 58.75 25.56 36.9 5.48 2.04 6.07 Here is what I am trying to do with the finished script ESX Hosts per Cluster * RAM Not Sure how to add this to the current scipt. Foreach ($CLUS in Get-Cluster | Sort-Object Name ) {$VMHosts = Get-CLuster $CLUS | Get-VMHost; ($VMhosts.count * 147456) / 1024 } foreach($cluster in Get-Cluster | Sort-Object ) {     $esx = $cluster | Get-VMHost     $ds = Get-Datastore -VMHost $esx | where {$_.Type -eq "VMFS"}     $cluster | Select @{N="Cluster Name";E={$cluster.Name}},     @{N="Memory Usage (%)";E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddHours(-72) -IntervalMins 5 -MaxSamples (12) | Measure-Object Value -Average).Average),2)}} } Memory Usage (%)               Under 70 (%)          MB RAM Avail (calc X%*144GB*hosts) ------------                                   ------------               ------------ 67.27                                        x%                          X GB available 69 63.13 65.57 45.24 58.49 69.32 70.41 68.34 58.75 25.56 36.9 5.48 2.04 6.07
Right, and I have done this but I want the positive number.
We want to ensure that our ESX clusters are running under 70% memory utilization.  Is it possible to subtract 70 from Memory Usage (%) in the following script? foreach($cluster in Get-Cluste... See more...
We want to ensure that our ESX clusters are running under 70% memory utilization.  Is it possible to subtract 70 from Memory Usage (%) in the following script? foreach($cluster in Get-Cluster | Sort-Object ){ $esx = $cluster | Get-VMHost; $ds = Get-Datastore -VMHost $esx | where {$_.Type -eq "VMFS"}; $cluster | Select @{N="Cluster Name";E={$cluster.Name}}, @{N="Memory Usage (%)";E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddHours(-72) -IntervalMins 5 -MaxSamples (12) | Measure-Object Value -Average).Average),2)}} }