This commit is contained in:
mycloudrevolution
2016-12-05 12:48:38 +01:00
25 changed files with 6887 additions and 168 deletions

View File

@@ -0,0 +1,216 @@
function Recommend-Sizing {
<#
.NOTES
===========================================================================
Created by: Markus Kraus
Twitter: @VMarkus_K
Private Blog: mycloudrevolution.com
===========================================================================
Changelog:
2016.11 ver 1.0 Base Release
2016.11 ver 1.1 Optional Stats Collection.
===========================================================================
External Code Sources:
http://www.lucd.info/2011/04/22/get-the-maximum-iops/
https://communities.vmware.com/thread/485386
===========================================================================
Tested Against Environment:
vSphere Version: 5.5 U2
PowerCLI Version: PowerCLI 6.3 R1, PowerCLI 6.5 R1
PowerShell Version: 4.0, 5.0
OS Version: Windows 8.1, Server 2012 R2
===========================================================================
Keywords vSphere, ESXi, VM, Storage, Sizing
===========================================================================
.DESCRIPTION
This Function collects Basic vSphere Informations for a Hardware Sizing Recomamndation. Focus is in Compute Ressources.
.Example
Recommend-Sizing -ClusterNames Cluster01, Cluster02 -Stats -StatsRange 60 -Verbose
.Example
Recommend-Sizing -ClusterNames Cluster01, Cluster02
.Example
Recommend-Sizing -ClusterNames Cluster01
.PARAMETER ClusterNames
List of your vSphere Cluser Names to process.
.PARAMETER Stats
Enables Stats Collection.
Warning: At the moment this is only tested and supported with vSphere 5.5!
.PARAMETER StatsRange
Time Range in Minutes for the Stats Collection.
Default is 24h.
#Requires PS -Version 4.0
#Requires -Modules VMware.VimAutomation.Core, @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"}
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
[Array] $ClusterNames,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=2)]
[switch] $Stats,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=2)]
[int] $StatsRange = 1440
)
Begin {
if ($Stats) {
Write-Warning "Stats Collection enabled.`nAt the moment this is only tested and supported with vSphere 5.5"
[int]$TimeRange = "-" + $StatsRange
}
$Validate = $True
#region: Check Clusters
Write-Verbose "$(Get-Date -Format G) Starting Cluster Validation..."
foreach ($ClusterName in $ClusterNames) {
$TestCluster = Get-Cluster -Name $ClusterName -ErrorAction SilentlyContinue -Verbose:$False
if(!($TestCluster)){
Write-Warning "No Custer found wth Name $ClusterName!"
$Validate = $False
}
elseif ($TestCluster.count -gt 1) {
Write-Warning "Multiple Custers found wth Name $ClusterName!`nUse a List of explicit Cluster Names: Recommend-Sizing -ClusterNames Cluster01, Cluster02 "
$Validate = $False
}
}
Write-Verbose "$(Get-Date -Format G) Cluster Validation completed"
#endregion
}
Process {
$MyView = @()
if ($Validate -eq $True) {
foreach ($ClusterName in $ClusterNames) {
#region: Get Cluster Objects
Write-Verbose "$(Get-Date -Format G) Collect $ClusterName Cluster Objects..."
$Cluster = Get-Cluster -Name $ClusterName -Verbose:$False
$ClusterVMs = $Cluster | Get-VM -Verbose:$False
$ClusterVMsPoweredOn = $ClusterVMs | where {$_.PowerState -eq "PoweredOn"}
$ClusterDatastores = $Cluster | Get-Datastore -Verbose:$False
$ClusterHosts = $Cluster | Get-VMHost -Verbose:$False
$HostsAverageMemoryUsageGB = [math]::round( ($ClusterHosts | Measure-Object -Average -Property MemoryUsageGB).Average,1 )
$HostsAverageMemoryUsage = $([math]::round( (($ClusterHosts | Measure-Object -Average -Property MemoryUsageGB).Average / ($ClusterHosts | Measure-Object -Average -Property MemoryTotalGB).Average) * 100,1 ))
$HostsAverageCpuUsageMhz = [math]::round( ($ClusterHosts | Measure-Object -Average -Property CpuUsageMhz).Average,1 )
$HostsAverageCpuUsage = $([math]::round( (($ClusterHosts | Measure-Object -Average -Property CpuUsageMhz).Average / ($ClusterHosts | Measure-Object -Average -Property CpuTotalMhz).Average) * 100,1 ))
Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Cluster Objects completed"
#endregion
#region: CPU Calculation
Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) CPU Details..."
$VMvCPUs = ($ClusterVMs | Measure-Object -Sum -Property NumCpu).sum
$LogicalThreads = $Cluster.ExtensionData.Summary.NumCpuThreads
$CpuCores = $Cluster.ExtensionData.Summary.NumCpuCores
$vCPUpCPUratio = [math]::round( $VMvCPUs / $LogicalThreads,1 )
Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) CPU Details completed."
#endregion
#region: Memory Calculation
Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Memory Details..."
$AllocatedVMMemoryGB = [math]::round( ($ClusterVMs | Measure-Object -Sum -Property MemoryGB).sum )
$PhysicalMemory = [math]::round( $Cluster.ExtensionData.Summary.TotalMemory / 1073741824,1 )
$MemoryUsage = [math]::round( ($AllocatedVMMemoryGB / $PhysicalMemory) * 100 ,1 )
Write-Verbose "$(Get-Date -Format G) Collect $($Cluster.name) Memory Details completed"
#endregion
if ($Stats) {
#region: Creating Disk Metrics
Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) IOPS Metrics..."
$DiskMetrics = "virtualDisk.numberReadAveraged.average","virtualDisk.numberWriteAveraged.average"
$start = (Get-Date).AddMinutes($TimeRange)
$DiskStats = Get-Stat -Stat $DiskMetrics -Entity $ClusterVMsPoweredOn -Start $start -Verbose:$False
Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) IOPS Metrics completed"
#endregion
#region: Creating IOPS Reports
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) IOPS Report..."
$reportDiskPerf = @()
$reportDiskPerf = $DiskStats | Group-Object -Property {$_.Entity.Name},Instance | %{
New-Object PSObject -Property @{
IOPSMax = ($_.Group | `
Group-Object -Property Timestamp | `
%{$_.Group[0].Value + $_.Group[1].Value} | `
Measure-Object -Maximum).Maximum
}
}
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) IOPS Report completed"
#endregion
}
else {
Write-Verbose "$(Get-Date -Format G) Stats Cellocetion skipped..."
}
#region: Create VM Disk Space Report
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) VM Disk Space Report..."
$reportDiskSpace = @()
foreach ($ClusterVM in $ClusterVMs){
$VMDKs = $ClusterVM | get-HardDisk -Verbose:$False
foreach ($VMDK in $VMDKs) {
if ($VMDK -ne $null){
[int]$CapacityGB = $VMDK.CapacityKB/1024/1024
$Report = [PSCustomObject] @{
CapacityGB = $CapacityGB
}
$reportDiskSpace += $Report
}
}
}
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) VM Disk Space Report completed"
#endregion
#region: Create Datastore Space Report
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) Datastore Space Report..."
$DatastoreReport = @($ClusterDatastores | Select-Object @{N="CapacityGB";E={[math]::Round($_.CapacityGB,2)}}, @{N="FreeSpaceGB";E={[math]::Round($_.FreeSpaceGB,2)}}, @{N="UsedSpaceGB";E={[math]::Round($_.CapacityGB - $_.FreeSpaceGB,2)}})
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) Datastore Space Report completed"
#endregion
#region: Create Global Report
Write-Verbose "$(Get-Date -Format G) Process Global Report..."
$SizingReport = [PSCustomObject] @{
Cluster = $Cluster.name
HAEnabled = $Cluster.HAEnabled
DrsEnabled = $Cluster.DrsEnabled
Hosts = $Cluster.ExtensionData.Summary.NumHosts
HostsAverageMemoryUsageGB = $HostsAverageMemoryUsageGB
HostsAverageMemoryUsage = "$HostsAverageMemoryUsage %"
HostsAverageCpuUsageMhz = $HostsAverageCpuUsageMhz
HostsAverageCpuUsage = "$HostsAverageCpuUsage %"
PhysicalCPUCores = $CpuCores
LogicalCPUThreads = $LogicalThreads
VMs = $ClusterVMs.count
ActiveVMs = $ClusterVMsPoweredOn.count
VMvCPUs = $VMvCPUs
vCPUpCPUratio = "$vCPUpCPUratio : 1"
PhysicalMemoryGB = $PhysicalMemory
AllocatedVMMemoryGB = $AllocatedVMMemoryGB
ClusterMemoryUsage = "$MemoryUsage %"
SumVMDiskSpaceGB = [math]::round( ($reportDiskSpace | Measure-Object -Sum -Property CapacityGB).sum, 1 )
SumDatastoreSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property CapacityGB).sum, 1 )
SumDatastoreUsedSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property UsedSpaceGB).sum, 1 )
SumMaxVMIOPS = [math]::round( ($reportDiskPerf | Measure-Object -Sum -Property IOPSMax).sum, 1 )
AverageMaxVMIOPs = [math]::round( ($reportDiskPerf | Measure-Object -Average -Property IOPSMax).Average,1 )
}
$MyView += $SizingReport
Write-Verbose "$(Get-Date -Format G) Process Global Report completed"
#endregion
}
}
Else {
Write-Error "Validation Failed! Processing Skipped"
}
}
End {
$MyView
}
}

View File

@@ -7,58 +7,90 @@
Twitter: @vBrianGraf
VMware Blog: blogs.vmware.com/powercli
Personal Blog: www.vtagion.com
Modified on: 10/11/2016
Modified by: Erwan Quélin
Twitter: @erwanquelin
Github: https://github.com/equelin
===========================================================================
.DESCRIPTION
This function will allow users to view the VMCP settings for their clusters
This function will allow users to view the VMCP settings for their clusters
.Example
# This will show you the VMCP settings of your cluster
.PARAMETER Cluster
Cluster Name or Object
.PARAMETER Server
vCenter server object
.EXAMPLE
Get-VMCPSettings
This will show you the VMCP settings for all the clusters
.EXAMPLE
Get-VMCPSettings -cluster LAB-CL
.Example
# This will show you the VMCP settings of your cluster
Get-VMCPSettings -cluster (Get-Cluster Lab-CL)
This will show you the VMCP settings of your cluster
.EXAMPLE
Get-VMCPSettings -cluster (Get-Cluster Lab-CL)
This will show you the VMCP settings of your cluster
.EXAMPLE
Get-Cluster | Get-VMCPSettings
This will show you the VMCP settings for all the clusters
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory=$True,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True,
HelpMessage='What is the Cluster Name?')]
$cluster
)
Begin {
# Determine input and convert to ClusterImpl object
Switch ($cluster.GetType().Name)
{
"string" {$CL = Get-Cluster $cluster}
"ClusterImpl" {$CL = $cluster}
[CmdletBinding()]
param
(
[Parameter(Mandatory=$False,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True,
HelpMessage='What is the Cluster Name?')]
$cluster = (Get-Cluster -Server $Server),
[Parameter(Mandatory=$False)]
[VMware.VimAutomation.Types.VIServer[]]$Server = $global:DefaultVIServers
)
Process {
Foreach ($Clus in $Cluster) {
Write-Verbose "Processing Cluster $($Clus.Name)"
# Determine input and convert to ClusterImpl object
Switch ($Clus.GetType().Name)
{
"string" {$CL = Get-Cluster $Clus -Server $Server -ErrorAction SilentlyContinue}
"ClusterImpl" {$CL = $Clus}
}
If ($CL) {
# Work with the Cluster View
$ClusterMod = Get-View -Id "ClusterComputeResource-$($CL.ExtensionData.MoRef.Value)" -Server $Server
# Create Hashtable with desired properties to return
$properties = [ordered]@{
'Cluster' = $ClusterMod.Name;
'VMCP Status' = $clustermod.Configuration.DasConfig.VmComponentProtecting;
'Protection For APD' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForAPD;
'APD Timeout Enabled' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.EnableAPDTimeoutForHosts;
'APD Timeout (Seconds)' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmTerminateDelayForAPDSec;
'Reaction on APD Cleared' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmReactionOnAPDCleared;
'Protection For PDL' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForPDL
}
# Create PSObject with the Hashtable
$object = New-Object -TypeName PSObject -Prop $properties
# Show object
$object
}
}
}
Process {
# Work with the Cluster View
$ClusterMod = Get-View -Id "ClusterComputeResource-$($cl.ExtensionData.MoRef.Value)"
# Create Hashtable with desired properties to return
$properties = [ordered]@{
'Cluster' = $ClusterMod.Name;
'VMCP Status' = $clustermod.Configuration.DasConfig.VmComponentProtecting;
'Protection For APD' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForAPD;
'APD Timeout Enabled' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.EnableAPDTimeoutForHosts;
'APD Timeout (Seconds)' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmTerminateDelayForAPDSec;
'Reaction on APD Cleared' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmReactionOnAPDCleared;
'Protection For PDL' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForPDL
}
# Create PSObject with the Hashtable
$object = New-Object -TypeName PSObject -Prop $properties
# Show object
return $object
}
End {}
}
}
function Set-VMCPSettings {
@@ -70,151 +102,221 @@ function Set-VMCPSettings {
Twitter: @vBrianGraf
VMware Blog: blogs.vmware.com/powercli
Personal Blog: www.vtagion.com
Modified on: 10/11/2016
Modified by: Erwan Quélin
Twitter: @erwanquelin
Github: https://github.com/equelin
===========================================================================
.DESCRIPTION
This function will allow users to enable/disable VMCP and also allow
This function will allow users to enable/disable VMCP and also allow
them to configure the additional VMCP settings
For each parameter, users should use the 'Tab' button to auto-fill the
possible values.
.Example
# This will enable VMCP and configure the Settings
.PARAMETER Cluster
Cluster Name or Object
.PARAMETER enableVMCP
Enable or disable VMCP
.PARAMETER VmStorageProtectionForPDL
VM Storage Protection for PDL settings. Might be:
- disabled
- warning
- restartAggressive
.PARAMETER VmStorageProtectionForAPD
VM Storage Protection for APD settings. Might be:
- disabled
- restartConservative
- restartAggressive
- warning
.PARAMETER VmTerminateDelayForAPDSec
VM Terminate Delay for APD (seconds).
.PARAMETER VmReactionOnAPDCleared
VM reaction on APD Cleared. Might be:
- reset
- none
.PARAMETER Server
vCenter server object
.EXAMPLE
Set-VMCPSettings -cluster LAB-CL -enableVMCP:$True -VmStorageProtectionForPDL `
restartAggressive -VmStorageProtectionForAPD restartAggressive `
-VmTerminateDelayForAPDSec 2000 -VmReactionOnAPDCleared reset
.Example
# This will disable VMCP and configure the Settings
This will enable VMCP and configure the Settings on cluster LAB-CL
.EXAMPLE
Set-VMCPSettings -cluster LAB-CL -enableVMCP:$False -VmStorageProtectionForPDL `
disabled -VmStorageProtectionForAPD disabled `
-VmTerminateDelayForAPDSec 600 -VmReactionOnAPDCleared none
This will disable VMCP and configure the Settings on cluster LAB-CL
.EXAMPLE
Set-VMCPSettings -enableVMCP:$False -VmStorageProtectionForPDL `
disabled -VmStorageProtectionForAPD disabled `
-VmTerminateDelayForAPDSec 600 -VmReactionOnAPDCleared none
This will disable VMCP and configure the Settings on all clusters available
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory=$True,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True,
HelpMessage='What is the Cluster Name?')]
$cluster,
[Parameter(Mandatory=$True,
ValueFromPipeline=$False,
HelpMessage='True=Enabled False=Disabled')]
[switch]$enableVMCP,
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact="High")]
param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True,
HelpMessage='What is the Cluster Name?')]
$cluster,
[Parameter(Mandatory=$False,
ValueFromPipeline=$False,
HelpMessage='$True=Enabled $False=Disabled')]
[bool]$enableVMCP,
[Parameter(Mandatory=$True,
ValueFromPipeline=$False,
HelpMessage='Actions that can be taken in response to a PDL event')]
[ValidateSet("disabled","warning","restartAggressive")]
[string]$VmStorageProtectionForPDL,
[Parameter(Mandatory=$True,
ValueFromPipeline=$False,
HelpMessage='Options available for an APD response')]
[ValidateSet("disabled","restartConservative","restartAggressive","warning")]
[string]$VmStorageProtectionForAPD,
[Parameter(Mandatory=$True,
ValueFromPipeline=$False,
HelpMessage='Value in seconds')]
[Int]$VmTerminateDelayForAPDSec,
[Parameter(Mandatory=$True,
ValueFromPipeline=$False,
HelpMessage='This setting will instruct vSphere HA to take a certain action if an APD event is cleared')]
[ValidateSet("reset","none")]
[string]$VmReactionOnAPDCleared
[Parameter(Mandatory=$False,
ValueFromPipeline=$False,
HelpMessage='Actions that can be taken in response to a PDL event')]
[ValidateSet("disabled","warning","restartAggressive")]
[string]$VmStorageProtectionForPDL,
[Parameter(Mandatory=$False,
ValueFromPipeline=$False,
HelpMessage='Options available for an APD response')]
[ValidateSet("disabled","restartConservative","restartAggressive","warning")]
[string]$VmStorageProtectionForAPD,
[Parameter(Mandatory=$False,
ValueFromPipeline=$False,
HelpMessage='Value in seconds')]
[Int]$VmTerminateDelayForAPDSec,
[Parameter(Mandatory=$False,
ValueFromPipeline=$False,
HelpMessage='This setting will instruct vSphere HA to take a certain action if an APD event is cleared')]
[ValidateSet("reset","none")]
[string]$VmReactionOnAPDCleared,
[Parameter(Mandatory=$False)]
[VMware.VimAutomation.Types.VIServer[]]$Server = $global:DefaultVIServers
)
)
Begin{
Process {
# Determine input and convert to ClusterImpl object
Switch ($cluster.GetType().Name)
{
"string" {$CL = Get-Cluster $cluster}
"ClusterImpl" {$CL = $cluster}
}
}
Process{
# Create the object we will configure
$settings = New-Object VMware.Vim.ClusterConfigSpecEx
$settings.dasConfig = New-Object VMware.Vim.ClusterDasConfigInfo
# Based on $enableVMCP switch
if ($enableVMCP -eq $false) {
$settings.dasConfig.vmComponentProtecting = "disabled"
}
elseif ($enableVMCP -eq $true) {
$settings.dasConfig.vmComponentProtecting = "enabled"
}
Foreach ($Clus in $Cluster) {
#Create the VMCP object to work with
$settings.dasConfig.defaultVmSettings = New-Object VMware.Vim.ClusterDasVmSettings
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings = New-Object VMware.Vim.ClusterVmComponentProtectionSettings
#Storage Protection For PDL
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForPDL = "$VmStorageProtectionForPDL"
#Storage Protection for APD
switch ($VmStorageProtectionForAPD) {
"disabled" {
# If Disabled, there is no need to set the Timeout Value
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'disabled'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $false
}
"restartConservative" {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'restartConservative'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $true
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmTerminateDelayForAPDSec = $VmTerminateDelayForAPDSec
}
"restartAggressive" {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'restartAggressive'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $true
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmTerminateDelayForAPDSec = $VmTerminateDelayForAPDSec
}
"warning" {
# If Warning, there is no need to set the Timeout Value
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'warning'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $false
}
Write-Verbose "Processing Cluster $Clus"
# Determine input and convert to ClusterImpl object
Switch ($Clus.GetType().Name)
{
"string" {$CL = Get-Cluster $Clus -Server $Server -ErrorAction SilentlyContinue}
"ClusterImpl" {$CL = $Clus}
default {Throw 'Please provide a cluster name or object'}
}
# Reaction On APD Cleared
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmReactionOnAPDCleared = "$VmReactionOnAPDCleared"
# Execute API Call
$modify = $true
$ClusterMod = Get-View -Id "ClusterComputeResource-$($cl.ExtensionData.MoRef.Value)"
$ClusterMod.ReconfigureComputeResource_Task($settings, $modify) | out-null
If ($CL) {
# Get the actual configuration of the Cluster
$ActualSettings = Get-VMCPSettings -Cluster $CL -Server $Server
}
End{
# Update variable data after API call
$ClusterMod.updateViewData()
# Show actual settings in the verbose mode
Write-Verbose "[$($CL.Name)] Actual VMCP settings "
Write-Verbose $ActualSettings
# Create Hashtable with desired properties to return
$properties = [ordered]@{
'Cluster' = $ClusterMod.Name;
'VMCP Status' = $clustermod.Configuration.DasConfig.VmComponentProtecting;
'Protection For APD' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForAPD;
'APD Timeout Enabled' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.EnableAPDTimeoutForHosts;
'APD Timeout (Seconds)' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmTerminateDelayForAPDSec;
'Reaction on APD Cleared' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmReactionOnAPDCleared;
'Protection For PDL' = $clustermod.Configuration.DasConfig.DefaultVmSettings.VmComponentProtectionSettings.VmStorageProtectionForPDL
# Create the object we will configure
$settings = New-Object VMware.Vim.ClusterConfigSpecEx
$settings.dasConfig = New-Object VMware.Vim.ClusterDasConfigInfo
# Based on $enableVMCP switch
if ($enableVMCP -eq $false) {
$settings.dasConfig.vmComponentProtecting = "disabled"
}
elseif ($enableVMCP -eq $true) {
$settings.dasConfig.vmComponentProtecting = "enabled"
}
#Create the VMCP object to work with
$settings.dasConfig.defaultVmSettings = New-Object VMware.Vim.ClusterDasVmSettings
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings = New-Object VMware.Vim.ClusterVmComponentProtectionSettings
#Storage Protection For PDL
If ($PSBoundParameters.ContainsKey('VmStorageProtectionForPDL')) {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForPDL = $VmStorageProtectionForPDL
} else {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForPDL = $ActualSettings.'Protection For PDL'
}
#Storage Protection for APD
If ($PSBoundParameters.ContainsKey('VmStorageProtectionForAPD')) {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = $VmStorageProtectionForAPD
} else {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = $ActualSettings.'Protection For APD'
}
#Storage Protection for APD
If ($PSBoundParameters.ContainsKey('VmStorageProtectionForAPD')) {
switch ($VmStorageProtectionForAPD) {
"disabled" {
# If Disabled, there is no need to set enable Timeout Value
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'disabled'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $false
}
"restartConservative" {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'restartConservative'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $true
}
"restartAggressive" {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'restartAggressive'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $true
}
"warning" {
# If Warning, there is no need to enable the Timeout Value
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = 'warning'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $false
}
}
} else {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmStorageProtectionForAPD = $ActualSettings.'Protection For APD'
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.enableAPDTimeoutForHosts = $ActualSettings.'APD Timeout Enabled'
}
#APD Timeout Enabled
If ($PSBoundParameters.ContainsKey('VmTerminateDelayForAPDSec')) {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmTerminateDelayForAPDSec = $VmTerminateDelayForAPDSec
} else {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmTerminateDelayForAPDSec = $ActualSettings.'APD Timeout (Seconds)'
}
# Reaction On APD Cleared
If ($PSBoundParameters.ContainsKey('VmReactionOnAPDCleared')) {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmReactionOnAPDCleared = "$VmReactionOnAPDCleared"
} else {
$settings.dasConfig.defaultVmSettings.vmComponentProtectionSettings.vmReactionOnAPDCleared = $ActualSettings.'Reaction on APD Cleared'
}
# Execute API Call
If ($pscmdlet.ShouldProcess($CL.Name,"Modify VMCP configuration")) {
$modify = $true
$ClusterMod = Get-View -Id "ClusterComputeResource-$($CL.ExtensionData.MoRef.Value)" -Server $Server
$Task = $ClusterMod.ReconfigureComputeResource_Task($settings, $modify)
}
# Wait for the reconfiguration task to finish to show the result
If ($Task) {
$TaskID = "Task-" + $($Task.Value)
Get-Task -Id $TaskID -Server $Server | Wait-Task | Out-Null
Get-VMCPSettings -Cluster $CL -Server $Server
}
}
}
}
# Create PSObject with the Hashtable
$object = New-Object -TypeName PSObject -Prop $properties
# Show object
return $object
}
}

View File

@@ -0,0 +1,6 @@
[InternetShortcut]
URL=https://github.com/lucdekens/LogInsight/blob/v1.0/LICENSE.txt
IDList=
HotKey=0
IconFile=C:\Users\ldekens\AppData\Local\Mozilla\Firefox\Profiles\2ahnnh1i.default\shortcutCache\ec4nFcIEAQBPFmSiPtTJ2w==.ico
IconIndex=0

View File

@@ -0,0 +1,18 @@
@{
ModuleToProcess = 'VMFSIncrease.psm1'
ModuleVersion = '1.0.0.0'
GUID = '9f167385-c5c6-4a65-ac14-949c67519001'
Author = 'Luc Dekens '
CompanyName = 'Community'
Copyright = '(c) 2016. All rights reserved.'
Description = 'Expand and Extend VMFS DatastoresModule description'
PowerShellVersion = '3.0'
FunctionsToExport = 'Get-VmfsDatastoreInfo','Get-VmfsDatastoreIncrease','New-VmfsDatastoreIncrease'
PrivateData = @{
PSData = @{
Tags = @('VMFS','Expand','Extend','vSphere')
LicenseUri = 'https://www.tldrlegal.com/l/mit'
ProjectUri = 'https://github.com/lucdekens/VMFSIncrease'
}
}
}

View File

@@ -0,0 +1,247 @@
function Get-VmfsDatastoreInfo
{
[CmdletBinding(SupportsShouldProcess = $True)]
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $True)]
[PSObject]$Datastore
)
Process
{
if ($Datastore -is [String])
{
$Datastore = Get-Datastore -Name $Datastore -ErrorAction SilentlyContinue
}
if ($Datastore -isnot [VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.Datastore])
{
Write-Error 'Invalid value for Datastore.'
return
}
if ($Datastore.Type -ne 'VMFS')
{
Write-Error "$($Datastore.Name) is not a VMFS datastore"
return
}
# Get the Datastore System Manager from an ESXi that has the Datastore
$esx = Get-View -Id ($Datastore.ExtensionData.Host | Get-Random | Select -ExpandProperty Key)
$hsSys = Get-View -Id $esx.ConfigManager.StorageSystem
foreach ($extent in $Datastore.ExtensionData.Info.Vmfs.Extent)
{
$lun = $esx.Config.StorageDevice.ScsiLun | where{ $_.CanonicalName -eq $extent.DiskName }
$hdPartInfo = $hsSys.RetrieveDiskPartitionInfo($lun.DeviceName)
$hdPartInfo[0].Layout.Partition | %{
New-Object PSObject -Property ([ordered]@{
Datastore = $Datastore.Name
CanonicalName = $lun.CanonicalName
Model = "$($lun.Vendor.TrimEnd(' ')).$($lun.Model.TrimEnd(' ')).$($lun.Revision.TrimEnd(' '))"
DiskSizeGB = $hdPartInfo[0].Layout.Total.BlockSize * $hdPartInfo[0].Layout.Total.Block / 1GB
DiskBlocks = $hdPartInfo[0].Layout.Total.Block
DiskBlockMB = $hdPartInfo[0].Layout.Total.BlockSize/1MB
PartitionFormat = $hdPartInfo[0].Spec.PartitionFormat
Partition = if ($_.Partition -eq '') { '<free>' }else{ $_.Partition }
Used = $extent.Partition -eq $_.Partition
Type = $_.Type
PartitionSizeGB = [math]::Round(($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize / 1GB, 1)
PartitionBlocks = $_.End.Block - $_.Start.Block + 1
PartitionBlockMB = $_.Start.BlockSize/1MB
Start = $_.Start.Block
End = $_.End.Block
})
}
}
}
}
function Get-VmfsDatastoreIncrease
{
[CmdletBinding(SupportsShouldProcess = $True)]
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $True)]
[PSObject]$Datastore
)
Process
{
if ($Datastore -is [String])
{
$Datastore = Get-Datastore -Name $Datastore -ErrorAction SilentlyContinue
}
if ($Datastore -isnot [VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.Datastore])
{
Write-Error 'Invalid value for Datastore.'
return
}
if ($Datastore.Type -ne 'VMFS')
{
Write-Error "$($Datastore.Name) is not a VMFS datastore"
return
}
# Get the Datastore System Manager from an ESXi that has the Datastore
$esx = Get-View -Id ($Datastore.ExtensionData.Host | Get-Random | Select -ExpandProperty Key)
$hsSys = Get-View -Id $esx.ConfigManager.StorageSystem
$hdSys = Get-View -Id $esx.ConfigManager.DatastoreSystem
$extents = $Datastore.ExtensionData.Info.Vmfs.Extent | Select -ExpandProperty DiskName
$hScsiDisk = $hdSys.QueryAvailableDisksForVmfs($Datastore.ExtensionData.MoRef)
foreach ($disk in $hScsiDisk)
{
$partInfo = $hsSys.RetrieveDiskPartitionInfo($disk.DeviceName)
$partUsed = ($partInfo[0].Layout.Partition | where{ $_.Type -eq 'VMFS' } | %{ ($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize } |
Measure-Object -Sum | select -ExpandProperty Sum)/1GB
if ($extents -contains $disk.CanonicalName)
{
$incType = 'Expand'
$vmfsExpOpt = $hdSys.QueryVmfsDatastoreExpandOptions($Datastore.ExtensionData.MoRef)
$PartMax = ($vmfsExpOpt[0].Info.Layout.Partition | where{ $_.Type -eq 'VMFS' } | %{ ($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize } |
Measure-Object -Sum | select -ExpandProperty Sum)/1GB
}
else
{
$incType = 'Extend'
$vmfsExtOpt = $hdSys.QueryVmfsDatastoreExtendOptions($Datastore.ExtensionData.MoRef, $disk.DevicePath, $null)
$partMax = ($vmfsExpOpt[0].Info.Layout.Partition | where{ $_.Type -eq 'VMFS' } | %{ ($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize } |
Measure-Object -Sum | select -ExpandProperty Sum)/1GB
}
New-Object PSObject -Property ([ordered]@{
Datastore = $Datastore.Name
CanonicalName = $disk.CanonicalName
Model = "$($disk.Vendor.TrimEnd(' ')).$($disk.Model.TrimEnd(' ')).$($disk.Revision.TrimEnd(' '))"
DiskSizeGB = $partInfo[0].Layout.Total.BlockSize * $hdPartInfo[0].Layout.Total.Block / 1GB
DiskBlocks = $partInfo[0].Layout.Total.Block
DiskBlockMB = $partInfo[0].Layout.Total.BlockSize/1MB
AvailableGB = [math]::Round($partMax - $partUsed, 2)
Type = $incType
})
}
}
}
function New-VmfsDatastoreIncrease
{
[CmdletBinding(SupportsShouldProcess = $True)]
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $True)]
[PSObject]$Datastore,
[int]$IncreaseSizeGB,
[Parameter(Position = 1)]
[string]$CanonicalName,
[Parameter(Mandatory = $true, ParameterSetName = 'Expand')]
[switch]$Expand,
[Parameter(Mandatory = $true, ParameterSetName = 'ExTend')]
[switch]$Extend
)
Process
{
if ($Datastore -is [String])
{
$Datastore = Get-Datastore -Name $Datastore -ErrorAction SilentlyContinue
}
if ($Datastore -isnot [VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.Datastore])
{
Write-Error 'Invalid value for Datastore.'
return
}
if ($Datastore.Type -ne 'VMFS')
{
Write-Error "$($Datastore.Name) is not a VMFS datastore"
return
}
# Get the Datastore System Manager from an ESXi that has the Datastore
$esx = Get-View -Id ($Datastore.ExtensionData.Host | Get-Random | Select -ExpandProperty Key)
$hsSys = Get-View -Id $esx.ConfigManager.StorageSystem
$hdSys = Get-View -Id $esx.ConfigManager.DatastoreSystem
$extents = $Datastore.ExtensionData.Info.Vmfs.Extent | Select -ExpandProperty DiskName
$hScsiDisk = $hdSys.QueryAvailableDisksForVmfs($Datastore.ExtensionData.MoRef)
# Expand or Extend
switch ($PSCmdlet.ParameterSetName)
{
'Expand' {
$expOpt = $hdSys.QueryVmfsDatastoreExpandOptions($Datastore.ExtensionData.MoRef)
if ($CanonicalName)
{
$dsOpt = $expOpt | where{ $_.Spec.Extent.DiskName -eq $CanonicalName }
}
else
{
$dsOpt = $expOpt | Sort-Object -Property { $_.Spec.Extent.Diskname } | select -first 1
}
if ($IncreaseSizeGB -ne 0)
{
$lun = $hScsiDisk | where{ $_.CanonicalName -eq $dsOpt.Spec.Extent.DiskName }
$partInfo = $hsSys.RetrieveDiskPartitionInfo($lun.DeviceName)
$partMax = ($vmfsExpOpt[0].Info.Layout.Partition | where{ $_.Type -eq 'VMFS' } | %{ ($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize } |
Measure-Object -Sum | select -ExpandProperty Sum)/1GB
$partUsed = ($partInfo[0].Layout.Partition | where{ $_.Type -eq 'VMFS' } | %{ ($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize } |
Measure-Object -Sum | select -ExpandProperty Sum)/1GB
if (($partMax - $partUsed) -ge $IncreaseSizeGB)
{
$spec = $dsOpt.Spec
$spec.Partition.Partition[0].EndSector -= ([math]::Floor(($partMax - $partUsed - $IncreaseSizeGB) * 1GB/512))
}
else
{
Write-Error "Requested expand size $($IncreaseSizeGB)GB not available on $($lun.CanonicalName)"
return
}
}
else
{
$spec = $dsOpt.Spec
}
$hdSys.ExpandVmfsDatastore($Datastore.ExtensionData.MoRef, $spec)
}
'Extend' {
if ($CanonicalName)
{
$lun = $hScsiDisk | where{ $extents -notcontains $_.CanonicalName -and $_.CanonicalName -eq $CanonicalName }
}
else
{
$lun = $hScsiDisk | where{ $extents -notcontains $_.CanonicalName } | Sort-Object -Property CanonicalName | select -First 1
}
if (!$lun)
{
Write-Error "No valid LUN provided or found for extent"
return
}
$vmfsExtOpt = $hdSys.QueryVmfsDatastoreExtendOptions($Datastore.ExtensionData.MoRef, $lun.DevicePath, $null)
if ($IncreaseSizeGB -ne 0)
{
$partInfo = $hsSys.RetrieveDiskPartitionInfo($lun.DeviceName)
$partMax = ($vmfsExpOpt[0].Info.Layout.Partition | where{ $_.Type -eq 'VMFS' } | %{ ($_.End.Block - $_.Start.Block + 1) * $_.Start.BlockSize } |
Measure-Object -Sum | select -ExpandProperty Sum)/1GB
if ($partMax -ge $IncreaseSizeGB)
{
$spec = $vmfsExtOpt[0].Spec
$spec.Partition.Partition[0].EndSector = $spec.Partition.Partition[0].StartSector + [math]::Floor($IncreaseSizeGB * 1GB / 512)
}
else
{
Write-Error "No valid LUN for extent with $($IncreaseSizeGB)GB space found"
return
}
}
else
{
$spec = $vmfsExtOpt.Spec
}
$hdSys.ExtendVmfsDatastore($Datastore.ExtensionData.MoRef, $spec)
}
}
}
}
Export-ModuleMember -Function Get-VmfsDatastoreInfo,Get-VmfsDatastoreIncrease,New-VmfsDatastoreIncrease

View File

@@ -0,0 +1,473 @@
<?xml version="1.0" encoding="utf-8" ?>
<helpItems xmlns="http://msh" schema="maml">
<!--Edited with: SAPIEN PowerShell HelpWriter 2015 v1.0.16-->
<!--Generated by: SAPIEN PowerShell HelpWriter 2015 v1.0.16-->
<!--
Module: VMFSIncrease
Version: 1.0.0.0
-->
<!--All Commands-->
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<!--Command-->
<command:details>
<command:name>Get-VmfsDatastoreInfo</command:name>
<maml:description>
<maml:para>Provides partition information for all the extents in the datastore.</maml:para>
</maml:description>
<maml:copyright>
<maml:para/>
</maml:copyright>
<command:verb>Get</command:verb>
<command:noun>VmfsDatastoreInfo</command:noun>
<dev:version/>
</command:details>
<maml:description>
<maml:para>The function will display partition information for all the extents used by the datastore.</maml:para>
</maml:description>
<command:syntax>
<!--Parameter Sets-->
<command:syntaxItem>
<maml:name>Get-VmfsDatastoreInfo</maml:name>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<!--All Parameters-->
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:type>
<maml:name>PSObject</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<!--Inputs-->
<command:inputType>
<dev:type>
<maml:name>System.Management.Automation.PSObject
</maml:name>
<maml:uri/>
</dev:type>
<maml:description>
<maml:para/>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues>
<!--Outputs-->
<command:returnValue>
<dev:type>
<maml:name>System.Object</maml:name>
<maml:uri/>
</dev:type>
<maml:description>
<maml:para/>
</maml:description>
</command:returnValue>
</command:returnValues>
<command:examples>
<!--Examples-->
<command:example>
<maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>Get-VmfsDatastoreInfo -Datastore MyDS</dev:code>
<dev:remarks>
<maml:para>Will return partition information for the Datastore named MyDS</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>Get-Datastore -Name My* | Get-VmfsDatastoreInfo</dev:code>
<dev:remarks>
<maml:para>This example will return partition information for all the Datastore objects that are returned by the Get-Datastore PowerCLI cmdlet</maml:para>
</dev:remarks>
</command:example>
</command:examples>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<!--Command-->
<command:details>
<command:name>Get-VmfsDatastoreIncrease</command:name>
<maml:description>
<maml:para>Displays the increase options for a datastore</maml:para>
</maml:description>
<maml:copyright>
<maml:para/>
</maml:copyright>
<command:verb>Get</command:verb>
<command:noun>VmfsDatastoreIncrease</command:noun>
<dev:version/>
</command:details>
<maml:description>
<maml:para>The function will provide all the Expand and Extend options for a specific datastore</maml:para>
</maml:description>
<command:syntax>
<!--Parameter Sets-->
<command:syntaxItem>
<maml:name>Get-VmfsDatastoreIncrease</maml:name>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<!--All Parameters-->
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:type>
<maml:name>PSObject</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<!--Inputs-->
<command:inputType>
<dev:type>
<maml:name>System.Management.Automation.PSObject
</maml:name>
<maml:uri/>
</dev:type>
<maml:description>
<maml:para/>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues>
<!--Outputs-->
<command:returnValue>
<dev:type>
<maml:name>System.Object</maml:name>
<maml:uri/>
</dev:type>
<maml:description>
<maml:para/>
</maml:description>
</command:returnValue>
</command:returnValues>
<command:examples>
<!--Examples-->
<command:example>
<maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>Get-VmfsDatastoreIncrease -Datastore MyDS</dev:code>
<dev:remarks>
<maml:para>The exmaple will list all Expand and Extend options available for the Datastore, named MyDS</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>Get-Datastore -Name MyDS* | Get-VmfsDatastoreIncrease</dev:code>
<dev:remarks>
<maml:para>The Expand and Extend options for all Datastore retruned by the PowerCLI Get-Datastore will be returned.</maml:para>
</dev:remarks>
</command:example>
</command:examples>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<!--Command-->
<command:details>
<command:name>New-VmfsDatastoreIncrease</command:name>
<maml:description>
<maml:para>Increase the capacity of a Datastore</maml:para>
</maml:description>
<maml:copyright>
<maml:para/>
</maml:copyright>
<command:verb>New</command:verb>
<command:noun>VmfsDatastoreIncrease</command:noun>
<dev:version/>
</command:details>
<maml:description>
<maml:para>The capacity of the Datastore in increased through an Expand or an Extend.
To allow successful completion there shall be free capacity on one of the Extents, or there shall be free LUNs available.
With the Expand or Extend switches the caller selects which type of capacity increase is used.</maml:para>
</maml:description>
<command:syntax>
<!--Parameter Sets-->
<command:syntaxItem>
<maml:name>New-VmfsDatastoreIncrease</maml:name>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
<maml:name>CanonicalName</maml:name>
<maml:description>
<maml:para>The Canonical name of the LUN on which to create a new Extent, or the name of the LUN on which to apply the Expansion.
If this parameter is not provided, the function will sort the available LUN alphanumerically on the Canonical names and slect the first one.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">String</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>IncreaseSizeGB</maml:name>
<maml:description>
<maml:para>The amount of GB by which to increase the size of the Datastore.
If this parameter is not used, all of the available Expand or Extend diskspace will be used.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">Int32</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>Expand</maml:name>
<maml:description>
<maml:para>A switch to indicate if the Datastore shall be Expanded</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
<command:syntaxItem>
<maml:name>New-VmfsDatastoreIncrease</maml:name>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
<maml:name>CanonicalName</maml:name>
<maml:description>
<maml:para>The Canonical name of the LUN on which to create a new Extent, or the name of the LUN on which to apply the Expansion.
If this parameter is not provided, the function will sort the available LUN alphanumerically on the Canonical names and slect the first one.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">String</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>IncreaseSizeGB</maml:name>
<maml:description>
<maml:para>The amount of GB by which to increase the size of the Datastore.
If this parameter is not used, all of the available Expand or Extend diskspace will be used.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">Int32</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>Extend</maml:name>
<maml:description>
<maml:para>A switch to indicate if the Datastore shall be Extended</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<!--All Parameters-->
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="">
<maml:name>Datastore</maml:name>
<maml:description>
<maml:para>The name of the Datastore or a PowerCLI Datastore object</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
<dev:type>
<maml:name>PSObject</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>IncreaseSizeGB</maml:name>
<maml:description>
<maml:para>The amount of GB by which to increase the size of the Datastore.
If this parameter is not used, all of the available Expand or Extend diskspace will be used.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">Int32</command:parameterValue>
<dev:type>
<maml:name>Int32</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
<maml:name>CanonicalName</maml:name>
<maml:description>
<maml:para>The Canonical name of the LUN on which to create a new Extent, or the name of the LUN on which to apply the Expansion.
If this parameter is not provided, the function will sort the available LUN alphanumerically on the Canonical names and slect the first one.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>Expand</maml:name>
<maml:description>
<maml:para>A switch to indicate if the Datastore shall be Expanded</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
<maml:name>Extend</maml:name>
<maml:description>
<maml:para>A switch to indicate if the Datastore shall be Extended</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue>
</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<!--Inputs-->
<command:inputType>
<dev:type>
<maml:name>System.Management.Automation.PSObject
</maml:name>
<maml:uri/>
</dev:type>
<maml:description>
<maml:para/>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues>
<!--Outputs-->
<command:returnValue>
<dev:type>
<maml:name>System.Object</maml:name>
<maml:uri/>
</dev:type>
<maml:description>
<maml:para/>
</maml:description>
</command:returnValue>
</command:returnValues>
<command:examples>
<!--Examples-->
<command:example>
<maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>New-VmfsDatastoreIncrease -Datastore MyDS -Expand</dev:code>
<dev:remarks>
<maml:para>The capacity of the Datastore, named MyDS, will be Expanded with all available free space on the first extent of the Datastore.</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>New-VmfsDatastoreIncrease -Name MyDS -Expand -IncreaseSizeGB 25</dev:code>
<dev:remarks>
<maml:para>The capacity of the Datastore, named MyDS, will be Expanded with 25GB on the first extent of the Datastore.
Provided if course, this amount of free space is available.</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>New-VmfsDatastoreIncrease -Datastore &apos;TestDS&apos; -Expand -IncreaseSizeGB 15 -CanonicalName &apos;naa.600507680180732f1800000000000011&apos;</dev:code>
<dev:remarks>
<maml:para>The capacity of the Datastore MyDS will be increased with 15GB on the extent with the Canonicalname naa.600507680180732f1800000000000011</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 4 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>New-VmfsDatastoreIncrease -Datastore MyDS -Expand -CanonicalName &apos;naa.600507680180732f1800000000000012&apos;</dev:code>
<dev:remarks>
<maml:para>The capacity of the Datastore MyDS will be increased with all available free space on the extent with the Canonicalname naa.600507680180732f1800000000000012</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 5 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>New-VmfsDatastoreIncrease -Datastore MyDS -Extend</dev:code>
<dev:remarks>
<maml:para>A new Extent will be added to Datastore MyDS.
All available free space of the LUN will be allocated.
The available LUNs are ordered alphanumerically by their Canonicalname, and the first LUN is used.</maml:para>
</dev:remarks>
</command:example>
<command:example>
<maml:title>-------------------------- EXAMPLE 6 --------------------------</maml:title>
<maml:introduction>
<maml:para>PS C:\&gt;</maml:para>
</maml:introduction>
<dev:code>Get-Datastore -Name MyDS | New-VmfsDatastoreIncrease -Extend -IncreaseSizeGB 50</dev:code>
<dev:remarks>
<maml:para>The capacity of the Datastore returned by the PowerCLI Get-Datastore cmdlet will be increased by 50GB.
This is done by adding a new Extent to the Datastore.
The available LUNs are ordered alphanumerically by their Canonicalname, and the first LUN is used.</maml:para>
</dev:remarks>
</command:example>
</command:examples>
</command:command>
<!--Generated by: SAPIEN PowerShell HelpWriter 2015 v1.0.16-->
</helpItems>

View File

@@ -0,0 +1,13 @@
TOPIC
VMFSIncrease
SYNOPSIS
The VMFSIncrease module offers the same functionality that is available
through the Increase button in the vSphere Web Client.
DESCRIPTION
The VMFSIncrease offers functionality that allows to Expand or Extend
VMFS Datastores. The module uses the vSphere API to implement this functionality.
SEE ALSO
http://www.lucd.info/2016/07/29/vmfs-datastores-expand-and-extend

View File

@@ -0,0 +1,80 @@
{
"Type": "AUTOMATED",
"Data": {
"Name": "LCFarmTest",
"DisplayName": "Ankit LC Farm Test",
"AccessGroup": "Root",
"Description": "created LC Farm from PS",
"Enabled": null,
"Deleting": false,
"Settings": null,
"Desktop": null,
"DisplayProtocolSettings": null,
"ServerErrorThreshold": null,
"MirageConfigurationOverrides": null
},
"AutomatedFarmSpec": {
"ProvisioningType": "VIEW_COMPOSER",
"VirtualCenter": null,
"RdsServerNamingSpec": {
"NamingMethod": "PATTERN",
"PatternNamingSettings": {
"NamingPattern": "LCFarmVM_PS",
"MaxNumberOfRDSServers": 1
}
},
"VirtualCenterProvisioningSettings": {
"EnableProvisioning": true,
"StopProvisioningOnError": true,
"MinReadyVMsOnVComposerMaintenance": 0,
"VirtualCenterProvisioningData": {
"ParentVm": "Win_Server_2012_R2",
"Snapshot": "Snap_RDS",
"Datacenter": null,
"VmFolder": "AnkitPoolVM",
"HostOrCluster": "cls",
"ResourcePool": "cls"
},
"VirtualCenterStorageSettings": {
"Datastores": [
{
"Datastore": "datastore1 (5)",
"StorageOvercommit": "UNBOUNDED"
}
],
"UseVSan": false,
"ViewComposerStorageSettings": {
"UseSeparateDatastoresReplicaAndOSDisks": false,
"ReplicaDiskDatastore": null,
"UseNativeSnapshots": false,
"SpaceReclamationSettings": {
"ReclaimVmDiskSpace": false,
"ReclamationThresholdGB": null,
"BlackoutTimes": null
}
}
},
"VirtualCenterNetworkingSettings": {
"Nics": null
}
},
"VirtualCenterManagedCommonSettings": {
"TransparentPageSharingScope": "VM"
},
"CustomizationSettings": {
"CustomizationType": "SYS_PREP",
"DomainAdministrator": null,
"AdContainer": "CN=Computers",
"ReusePreExistingAccounts": false,
"SysprepCustomizationSettings": {
"CustomizationSpec": "RDSH_Cust2"
}
},
"RdsServerMaxSessionsData": {
"MaxSessionsType": "UNLIMITED",
"MaxSessions": null
}
},
"ManualFarmSpec": null,
"NetBiosName" : "adankit"
}

View File

@@ -0,0 +1,24 @@
{
"Type": "MANUAL",
"Data": {
"Name": "manualFarmTest",
"DisplayName": "manualFarmTest",
"AccessGroup": "Root",
"Description": "Manual PS Test",
"Enabled": null,
"Deleting": false,
"Settings": null,
"Desktop": null,
"DisplayProtocolSettings": null,
"ServerErrorThreshold": null,
"MirageConfigurationOverrides": null
},
"AutomatedFarmSpec": null,
"ManualFarmSpec": {
"RdsServers": [
{
"rdsServer": "WIN-ORKA1Q8B0P7"
}
]
}
}

View File

@@ -0,0 +1,82 @@
{
"Base": {
"Name" : "FulClnJSON",
"DisplayName": "FullClonePraJSON",
"AccessGroup": "Root",
"Description": "create full clone via JSON"
},
"DesktopSettings": null,
"Type": "AUTOMATED",
"AutomatedDesktopSpec": {
"ProvisioningType": "VIRTUAL_CENTER",
"VirtualCenter": null,
"UserAssignment": {
"UserAssignment": "DEDICATED",
"AutomaticAssignment": true
},
"VmNamingSpec": {
"NamingMethod": "PATTERN",
"PatternNamingSettings": {
"NamingPattern": "FullClnJson1",
"MaxNumberOfMachines": 1,
"NumberOfSpareMachines": 1,
"ProvisioningTime": "UP_FRONT",
"MinNumberOfMachines": null
},
"SpecificNamingSpec": null
},
"VirtualCenterProvisioningSettings": {
"EnableProvisioning": true,
"StopProvisioningOnError": true,
"MinReadyVMsOnVComposerMaintenance": 0,
"VirtualCenterProvisioningData": {
"Template": "powerCLI-VM-TEMPLATE",
"ParentVm": null,
"Snapshot": null,
"Datacenter": null,
"VmFolder": "Praveen",
"HostOrCluster": "CS-1",
"ResourcePool": "CS-1"
},
"VirtualCenterStorageSettings": {
"Datastores": [
{
"Datastore": "datastore1",
"StorageOvercommit": "UNBOUNDED"
}
],
"UseVSan": false,
"ViewComposerStorageSettings": null,
"ViewStorageAcceleratorSettings": {
"UseViewStorageAccelerator": false,
"ViewComposerDiskTypes": null,
"RegenerateViewStorageAcceleratorDays": null,
"BlackoutTimes": null
}
},
"VirtualCenterNetworkingSettings": {
"Nics": null
}
},
"VirtualCenterManagedCommonSettings": {
"TransparentPageSharingScope": "VM"
},
"CustomizationSettings": {
"CustomizationType": "SYS_PREP",
"DomainAdministrator": null,
"AdContainer": "CN=Computers",
"ReusePreExistingAccounts": false,
"NoCustomizationSettings": {
"DoNotPowerOnVMsAfterCreation": false
},
"SysprepCustomizationSettings": null,
"QuickprepCustomizationSettings": null,
"CloneprepCustomizationSettings": null
}
},
"ManualDesktopSpec": null,
"RdsDesktopSpec": null,
"GlobalEntitlementData": null,
"NetBiosName" : "adviewdev",
"SysPrepName" : "praveencust"
}

View File

@@ -0,0 +1,105 @@
{
"Base": {
"Name" : "InsClnJSON",
"DisplayName": "insPoolPr",
"AccessGroup": "ROOT",
"Description": "create instant pool"
},
"DesktopSettings": null,
"Type": "AUTOMATED",
"AutomatedDesktopSpec": {
"ProvisioningType": "INSTANT_CLONE_ENGINE",
"VirtualCenter": null,
"UserAssignment": {
"UserAssignment": "FLOATING",
"AutomaticAssignment": true
},
"VmNamingSpec": {
"NamingMethod": "PATTERN",
"PatternNamingSettings": {
"NamingPattern": "inspoolJson1",
"MaxNumberOfMachines": 1,
"NumberOfSpareMachines": 1,
"ProvisioningTime": "UP_FRONT",
"MinNumberOfMachines": null
},
"SpecificNamingSpec": null
},
"VirtualCenterProvisioningSettings": {
"EnableProvisioning": true,
"StopProvisioningOnError": true,
"MinReadyVMsOnVComposerMaintenance": 0,
"VirtualCenterProvisioningData": {
"Template": null,
"ParentVm": "Agent_pra",
"Snapshot": "kb-hotfix",
"Datacenter": null,
"VmFolder": "Praveen",
"HostOrCluster": "CS-1",
"ResourcePool": "CS-1"
},
"VirtualCenterStorageSettings": {
"Datastores": [
{
"Datastore": "datastore1",
"StorageOvercommit": "UNBOUNDED"
}
],
"UseVSan": false,
"ViewComposerStorageSettings": {
"UseSeparateDatastoresReplicaAndOSDisks": false,
"ReplicaDiskDatastore": null,
"UseNativeSnapshots": false,
"SpaceReclamationSettings": {
"ReclaimVmDiskSpace": false,
"ReclamationThresholdGB": null
},
"PersistentDiskSettings": {
"RedirectWindowsProfile": false,
"UseSeparateDatastoresPersistentAndOSDisks": null,
"PersistentDiskDatastores": null,
"DiskSizeMB": null,
"DiskDriveLetter": null
},
"NonPersistentDiskSettings": {
"RedirectDisposableFiles": false,
"DiskSizeMB": null,
"DiskDriveLetter": null
}
},
"ViewStorageAcceleratorSettings": {
"UseViewStorageAccelerator": false,
"ViewComposerDiskTypes": null,
"RegenerateViewStorageAcceleratorDays": null,
"BlackoutTimes": null
}
},
"VirtualCenterNetworkingSettings": {
"Nics": null
}
},
"VirtualCenterManagedCommonSettings": {
"TransparentPageSharingScope": "VM"
},
"CustomizationSettings": {
"CustomizationType": "CLONE_PREP",
"DomainAdministrator": null,
"AdContainer": "CN=Computers",
"ReusePreExistingAccounts": false,
"NoCustomizationSettings": null,
"SysprepCustomizationSettings": null,
"QuickprepCustomizationSettings": null,
"CloneprepCustomizationSettings": {
"InstantCloneEngineDomainAdministrator": null,
"PowerOffScriptName": null,
"PowerOffScriptParameters": null,
"PostSynchronizationScriptName": null,
"PostSynchronizationScriptParameters": null
}
}
},
"ManualDesktopSpec": null,
"RdsDesktopSpec": null,
"GlobalEntitlementData": null,
"NetBiosName" : "adviewdev"
}

View File

@@ -0,0 +1,105 @@
{
"Base": {
"Name" : "LnkClnJSon",
"DisplayName": "praveen linkedclone pool",
"AccessGroup": "Root",
"Description": "created linkedclone pool from ps"
},
"DesktopSettings": null,
"Type": "AUTOMATED",
"AutomatedDesktopSpec": {
"ProvisioningType": "VIEW_COMPOSER",
"VirtualCenter": null,
"UserAssignment": {
"UserAssignment": "FLOATING",
"AutomaticAssignment": true
},
"VmNamingSpec": {
"NamingMethod": "PATTERN",
"PatternNamingSettings": {
"NamingPattern": "patternPra1",
"MaxNumberOfMachines": 1,
"NumberOfSpareMachines": 1,
"ProvisioningTime": "UP_FRONT",
"MinNumberOfMachines": null
},
"SpecificNamingSpec": null
},
"VirtualCenterProvisioningSettings": {
"EnableProvisioning": true,
"StopProvisioningOnError": true,
"MinReadyVMsOnVComposerMaintenance": 0,
"VirtualCenterProvisioningData": {
"Template": null,
"ParentVm": "Agent_pra",
"Snapshot": "kb-hotfix",
"Datacenter": null,
"VmFolder": "Praveen",
"HostOrCluster": "CS-1",
"ResourcePool": "CS-1"
},
"VirtualCenterStorageSettings": {
"Datastores": [
{
"Datastore": "datastore1",
"StorageOvercommit": "UNBOUNDED"
}
],
"UseVSan": false,
"ViewComposerStorageSettings": {
"UseSeparateDatastoresReplicaAndOSDisks": false,
"ReplicaDiskDatastore": null,
"UseNativeSnapshots": false,
"SpaceReclamationSettings": {
"ReclaimVmDiskSpace": false,
"ReclamationThresholdGB": null
},
"PersistentDiskSettings": {
"RedirectWindowsProfile": false,
"UseSeparateDatastoresPersistentAndOSDisks": null,
"PersistentDiskDatastores": null,
"DiskSizeMB": null,
"DiskDriveLetter": null
},
"NonPersistentDiskSettings": {
"RedirectDisposableFiles": false,
"DiskSizeMB": null,
"DiskDriveLetter": null
}
},
"ViewStorageAcceleratorSettings": {
"UseViewStorageAccelerator": false,
"ViewComposerDiskTypes": null,
"RegenerateViewStorageAcceleratorDays": null,
"BlackoutTimes": null
}
},
"VirtualCenterNetworkingSettings": {
"Nics": null
}
},
"VirtualCenterManagedCommonSettings": {
"TransparentPageSharingScope": "VM"
},
"CustomizationSettings": {
"CustomizationType": "QUICK_PREP",
"DomainAdministrator": null,
"AdContainer": "CN=Computers",
"ReusePreExistingAccounts": false,
"NoCustomizationSettings": null,
"SysprepCustomizationSettings": null,
"QuickprepCustomizationSettings": {
"PowerOffScriptName": null,
"PowerOffScriptParameters": null,
"PostSynchronizationScriptName": null,
"PostSynchronizationScriptParameters": null
},
"CloneprepCustomizationSettings": null
}
},
"ManualDesktopSpec": null,
"RdsDesktopSpec": null,
"GlobalEntitlementData": null,
"NetBiosName" : "adviewdev",
"SysPrepName" : "praveencust"
}

View File

@@ -0,0 +1,35 @@
{
"Base": {
"Name" : "MnlJson",
"DisplayName": "MNLPUL",
"AccessGroup": "ROOT",
"Description": "Manual pool creation"
},
"DesktopSettings": null,
"Type": "MANUAL",
"AutomatedDesktopSpec": null,
"ManualDesktopSpec": {
"UserAssignment": {
"UserAssignment": "FLOATING",
"AutomaticAssignment": true
},
"Source": "VIRTUAL_CENTER",
"Machines": [
{
"Machine" : "PowerCLI-VM"
}
],
"VirtualCenter": null,
"ViewStorageAcceleratorSettings": {
"UseViewStorageAccelerator": false,
"ViewComposerDiskTypes": null,
"RegenerateViewStorageAcceleratorDays": null,
"BlackoutTimes": null
},
"VirtualCenterManagedCommonSettings": {
"TransparentPageSharingScope": "VM"
}
},
"RdsDesktopSpec": null,
"GlobalEntitlementData": null
}

View File

@@ -0,0 +1,16 @@
{
"Base": {
"Name" : "RdsJson",
"DisplayName": "TestRDSPS",
"AccessGroup": "Root",
"Description": "Testing PS"
},
"DesktopSettings": null,
"Type": "RDS",
"AutomatedDesktopSpec": null,
"ManualDesktopSpec": null,
"RdsDesktopSpec": {
"Farm": "Farm2"
},
"GlobalEntitlementData": null
}

View File

@@ -0,0 +1,6 @@
{
"data.description" : "update through edit farm function",
"data.displayName" : "LCFarmTestUpdated1",
"data.displayProtocolSettings.defaultDisplayProtocol" : "PCOIP",
"automatedFarmData.virtualCenterManagedCommonSettings.transparentPageSharingScope" : "FARM"
}

View File

@@ -0,0 +1,5 @@
{
"data.description" : "update through edit farm function",
"data.displayName" : "ManualFarmTestUpdated1",
"data.displayProtocolSettings.defaultDisplayProtocol" : "PCOIP"
}

View File

@@ -0,0 +1,8 @@
{
"base.description" : "update through edit pool function",
"base.displayName" : "Henry2DspNm",
"desktopSettings.displayProtocolSettings.defaultDisplayProtocol" : "BLAST",
"automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.useViewStorageAccelerator" : true,
"automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.viewComposerDiskTypes" : "OS_DISKS",
"automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.regenerateViewStorageAcceleratorDays" : 8
}

View File

@@ -0,0 +1,8 @@
{
"base.description" : "update through edit pool",
"base.displayName" : "pooldisp",
"desktopSettings.displayProtocolSettings.defaultDisplayProtocol" : "BLAST",
"manualDesktopData.viewStorageAcceleratorSettings.useViewStorageAccelerator" : true,
"manualDesktopData.viewStorageAcceleratorSettings.viewComposerDiskTypes" : "OS_DISKS",
"manualDesktopData.viewStorageAcceleratorSettings.regenerateViewStorageAcceleratorDays" : 8
}

View File

@@ -0,0 +1,6 @@
{
"base.description" : "update through edit pool function",
"base.displayName" : "RDS2DspNm",
"desktopSettings.flashSettings.quality" : "LOW",
"desktopSettings.flashSettings.throttling" : "CONSERVATIVE"
}

View File

@@ -0,0 +1,95 @@
#
# Module manifest for module 'VMware.HV'
#
# Generated by: "VMware"
#
# Generated on: 9/20/2016
#
@{
# Script module or binary module file associated with this manifest.
# RootModule = ''
# Version number of this module.
ModuleVersion = '1.0'
# ID used to uniquely identify this module
GUID = '6d3f7fb5-4e52-43d8-91e1-f65f72532a1d'
# Author of this module
Author = 'VMware'
# Company or vendor of this module
CompanyName = 'VMware, Inc.'
# Copyright statement for this module
Copyright = 'Copyright (c) 2016 VMware, Inc. All rights reserved.'
# Description of the functionality provided by this module
# Description = 'This Windows PowerShell script module contains Advanced functions of VIEW API Service.'
# Minimum version of the Windows PowerShell engine required by this module
# PowerShellVersion = ''
# Name of the Windows PowerShell host required by this module
# PowerShellHostName = ''
# Minimum version of the Windows PowerShell host required by this module
# PowerShellHostVersion = ''
# Minimum version of the .NET Framework required by this module
# DotNetFrameworkVersion = ''
# Minimum version of the common language runtime (CLR) required by this module
# CLRVersion = ''
# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''
# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @('VMware.VimAutomation.HorizonView')
# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @('VMware.HV.Helper.psm1')
# Functions to export from this module
FunctionsToExport = '*'
# Cmdlets to export from this module
CmdletsToExport = '*'
# Variables to export from this module
VariablesToExport = '*'
# Aliases to export from this module
AliasesToExport = '*'
# List of all modules packaged with this module.
# ModuleList = @()
# List of all files packaged with this module
# FileList = @()
# Private data to pass to the module specified in RootModule/ModuleToProcess
# PrivateData = ''
# HelpInfo URI of this module
# HelpInfoURI = ''
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
<#
.MYNGC_REPORT
KEY\(VM\)
.LABEL
VM Snapshot Report
.DESCRIPTION
PowerActions Report Script that reports on VMs with snapshots along with their description, date of the snapshot, age in days of the snapshot, size of the snapshot in GB,
the VM's provisioned vs. used space in GB, if the snapshot is the current one being used, its parent snapshot (if there is one), and the Power state of the VM itself. VM
object is key (as it's the first managed object in the output), enabling you the ability to right-click an entry in the report to edit the target VM. Version 1.0, written
by Aaron Smith (@awsmith99), published 08/10/2016.
#>
param
(
[Parameter(Mandatory=$true)]
[VMware.VimAutomation.ViCore.Types.V1.Inventory.Cluster]
$vParam
);
[Array] $vmList = @( Get-VM -Location $vParam | Sort Name );
foreach ( $vmItem in $vmList )
{
[Array] $vmSnapshotList = @( Get-Snapshot -VM $vmItem );
foreach ( $snapshotItem in $vmSnapshotList )
{
$vmProvisionedSpaceGB = [Math]::Round( $vmItem.ProvisionedSpaceGB, 2 );
$vmUsedSpaceGB = [Math]::Round( $vmItem.UsedSpaceGB, 2 );
$snapshotSizeGB = [Math]::Round( $snapshotItem.SizeGB, 2 );
$snapshotAgeDays = ((Get-Date) - $snapshotItem.Created).Days;
$output = New-Object -TypeName PSObject;
$output | Add-Member -MemberType NoteProperty -Name "VM" -Value $vmItem;
$output | Add-Member -MemberType NoteProperty -Name "Name" -Value $snapshotItem.Name;
$output | Add-Member -MemberType NoteProperty -Name "Description" -Value $snapshotItem.Description;
$output | Add-Member -MemberType NoteProperty -Name "Created" -Value $snapshotItem.Created;
$output | Add-Member -MemberType NoteProperty -Name "AgeDays" -Value $snapshotAgeDays;
$output | Add-Member -MemberType NoteProperty -Name "ParentSnapshot" -Value $snapshotItem.ParentSnapshot.Name;
$output | Add-Member -MemberType NoteProperty -Name "IsCurrentSnapshot" -Value $snapshotItem.IsCurrent;
$output | Add-Member -MemberType NoteProperty -Name "SnapshotSizeGB" -Value $snapshotSizeGB;
$output | Add-Member -MemberType NoteProperty -Name "ProvisionedSpaceGB" -Value $vmProvisionedSpaceGB;
$output | Add-Member -MemberType NoteProperty -Name "UsedSpaceGB" -Value $vmUsedSpaceGB;
$output | Add-Member -MemberType NoteProperty -Name "PowerState" -Value $snapshotItem.PowerState;
$output;
}
}

View File

@@ -189,4 +189,4 @@ Members:
* Rynardt Spies (Community Member)
## Approval of Additions
Items added to the repository, including items from the Board members, require 2 votes from the board members before being added to the repository. The approving members will have ideally downloaded and tested the item. When two “Approved for Merge” comments are added from board members, the pull can then be committed to the repository.
Items added to the repository, including items from the Board members, require a review and approval from at least one board member before being added to the repository. The approving member/s will have verified for a lack of malicious code. Once an “Approved for Merge” comment has been added from a board member, the pull can then be committed to the repository.

View File

@@ -0,0 +1,49 @@
Function Get-HVDesktop {
<#
.SYNOPSIS
This cmdlet retrieves the virtual desktops on a horizon view Server.
.DESCRIPTION
This cmdlet retrieves the virtual desktops on a horizon view Server.
.NOTES
Author: Alan Renouf, @alanrenouf,virtu-al.net
.PARAMETER State
Hash table containing states to filter on
.EXAMPLE
List All Desktops
Get-HVDesktop
.EXAMPLE
List All Problem Desktops
Get-HVDesktop -state @('PROVISIONING_ERROR',
'ERROR',
'AGENT_UNREACHABLE',
'AGENT_ERR_STARTUP_IN_PROGRESS',
'AGENT_ERR_DISABLED',
'AGENT_ERR_INVALID_IP',
'AGENT_ERR_NEED_REBOOT',
'AGENT_ERR_PROTOCOL_FAILURE',
'AGENT_ERR_DOMAIN_FAILURE',
'AGENT_CONFIG_ERROR',
'UNKNOWN')
#>
Param (
$State
)
$ViewAPI = $global:DefaultHVServers[0].ExtensionData
$query_service = New-Object "Vmware.Hv.QueryServiceService"
$query = New-Object "Vmware.Hv.QueryDefinition"
$query.queryEntityType = 'MachineSummaryView'
if ($State) {
[VMware.Hv.QueryFilter []] $filters = @()
foreach ($filterstate in $State) {
$filters += new-object VMware.Hv.QueryFilterEquals -property @{'memberName' = 'base.basicState'; 'value' = $filterstate}
}
$orFilter = new-object VMware.Hv.QueryFilterOr -property @{'filters' = $filters}
$query.Filter = $orFilter
}
$Desktops = $query_service.QueryService_Query($ViewAPI,$query)
$Desktops.Results.Base
}

View File

@@ -0,0 +1,228 @@
function Get-PowerCLIInitialization {
<#
.SYNOPSIS
Gathers information on PowerShell resources which refer to the old PowerCLI Initialization Script
.DESCRIPTION
Will provide an inventory of scripts, modules, etc refering to the old vSphere PowerCLI directory
.NOTES
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
.PARAMETER Path
Directory path to be searched
.EXAMPLE
Get-PowerCLIInitialization -Path C:\Temp\Scripts
Gathers information from the 'C:\Temp\Scripts\' directory
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)]
[string]$Path
)
Process {
#Validate whether a path was passed as a parameter or not
if (!$Path) {$FullName = (Get-Location).ProviderPath}
else {
#Validate whether the path passed as a parameter was a literal path or not, then establish the FullName of the desired path
if ((Test-Path -Path $Path -ErrorAction SilentlyContinue) -eq $true -and $Path -is [System.IO.DirectoryInfo]) {$FullName = (Get-Item -Path $Path).FullName}
elseif ((Test-Path -Path $Path -ErrorAction SilentlyContinue) -eq $true -and $Path -isnot [System.IO.DirectoryInfo]) {$FullName = (Get-Item -LiteralPath $Path).FullName}
else {
$currdir = (Get-Location).ProviderPath
Write-Warning "No valid path found at - $currdir\$Path"
}
}
if ($FullName) {
#Gather scripts using ps1 extension and have a string matching "\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
$scripts = Get-ChildItem -Path $FullName -Recurse -Filter *.ps1 -File -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Select-String -Pattern "\\VMware\\Infrastructure\\vSphere PowerCLI\\Scripts\\Initialize-PowerCLIEnvironment.ps1"
#Create a report of neccessary output based on the scripts gathered above
$scriptreport = @()
foreach ($script in $scripts) {
$singleitem = New-Object System.Object
$singleitem | Add-Member -Type NoteProperty -Name Filename -Value $script.Filename
$singleitem | Add-Member -Type NoteProperty -Name LineNumber -Value $script.LineNumber
$singleitem | Add-Member -Type NoteProperty -Name Path -Value $script.Path.TrimEnd($script.Filename)
$singleitem | Add-Member -Type NoteProperty -Name FullPath -Value $script.Path
$scriptreport += $singleitem
}
return $scriptreport
}
} # End of process
} # End of function
function Get-PowerCLISnapinUse {
<#
.SYNOPSIS
Gathers information on PowerShell resources which refer to the old PowerCLI Snapins
.DESCRIPTION
Will provide an inventory of scripts, modules, etc refering to the old PowerCLI Snapins
.NOTES
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
.PARAMETER Path
Directory path to be searched
.EXAMPLE
Get-PowerCLISnapinUse -Path C:\Temp\Scripts
Gathers information from the 'C:\Temp\Scripts\' directory
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)]
[string]$Path
)
Process {
#Validate whether a path was passed as a parameter or not
if (!$Path) {$FullName = (Get-Location).ProviderPath}
else {
#Validate whether the path passed as a parameter was a literal path or not, then establish the FullName of the desired path
if ((Test-Path -Path $Path -ErrorAction SilentlyContinue) -eq $true -and $Path -is [System.IO.DirectoryInfo]) {$FullName = (Get-Item -Path $Path).FullName}
elseif ((Test-Path -Path $Path -ErrorAction SilentlyContinue) -eq $true -and $Path -isnot [System.IO.DirectoryInfo]) {$FullName = (Get-Item -LiteralPath $Path).FullName}
else {
$currdir = (Get-Location).ProviderPath
Write-Warning "No valid path found at - $currdir\$Path"
}
}
if ($FullName) {
#Gather scripts using ps1 extension and have a string matching "add-pssnapin" and "VMware." on the same line
$scripts = Get-ChildItem -Path $FullName -Recurse -Filter *.ps1 -File -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Select-String -Pattern "add-pssnapin" | Where-Object {$_ | Select-String -Pattern "VMware."}
#Create a report of neccessary output based on the scripts gathered above
$scriptreport = @()
foreach ($script in $scripts) {
$singleitem = New-Object System.Object
$singleitem | Add-Member -Type NoteProperty -Name Filename -Value $script.Filename
$singleitem | Add-Member -Type NoteProperty -Name LineNumber -Value $script.LineNumber
$singleitem | Add-Member -Type NoteProperty -Name Path -Value $script.Path.TrimEnd($script.Filename)
$singleitem | Add-Member -Type NoteProperty -Name FullPath -Value $script.Path
$scriptreport += $singleitem
}
return $scriptreport
}
} # End of process
} # End of function
function Update-PowerCLIInitialization {
<#
.SYNOPSIS
Updates the information in PowerShell resources which refer to the old PowerCLI Initialization Script
.DESCRIPTION
Will update scripts, modules, etc refering to the old vSphere PowerCLI directory
.NOTES
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
.PARAMETER Path
Directory path to be searched
.EXAMPLE
Update-PowerCLIInitialization -Path C:\Temp\Scripts
Gathers information from the 'C:\Temp\Scripts\' directory
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)]
[string]$Path
)
Process {
#Gather scripts using ps1 extension and have a string matching "\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
$scripts = Get-PowerCLIInitialization -Path $Path
#Check to see if any scripts are found
if (!$scripts) {Write-Warning "No PowerShell resources found requiring update within $Path"}
else {
foreach ($script in $scripts) {
#Finds and updates the string to the new location of the Initialize-PowerCLIEnvironment.ps1 script
(Get-Content $script.FullPath).Replace("\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1","\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1") | Set-Content $script.FullPath
}
}
} # End of process
} # End of function
function Update-PowerCLISnapinUse {
<#
.SYNOPSIS
Updates the information in PowerShell resources which refer to the old PowerCLI Initialization Script
.DESCRIPTION
Will update scripts, modules, etc refering to the old vSphere PowerCLI directory
.NOTES
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
.PARAMETER Path
Directory path to be searched
.EXAMPLE
Update-PowerCLISnapinUse -Path C:\Temp\Scripts
Gathers information from the 'C:\Temp\Scripts\' directory
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$false,Position=0,ValueFromPipelineByPropertyName=$true)]
[string]$Path
)
Process {
#Gather scripts using ps1 extension and have a string matching "\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
$scripts = Get-PowerCLISnapinUse -Path $Path | select -Unique FullPath
#Check to see if any scripts are found
if (!$scripts) {Write-Warning "No PowerShell resources found requiring update within $Path"}
else {
foreach ($script in $scripts) {
#Finds and updates the string to import the PowerCLI modules
$scriptcontent = (Get-Content $script.FullPath)
$newoutput = @()
[int]$counter = 0
foreach ($line in $scriptcontent) {
#Checks to see if the line includes adding in the VMware PSSnapins and, if so, comments it out
#On first discovery, adds the invokation of get-module for the PowerCLI modules
if ($line -like "Add-PSSnapin*VMware*" -and $counter -eq 0) {
$newoutput += "Get-Module -ListAvailable VMware* | Import-Module"
$newoutput += $line.Insert(0,'#')
$counter = 1
}
elseif ($line -like "Add-PSSnapin*VMware*" -and $counter -eq 1) {
$newoutput += $line.Insert(0,'#')
}
else {$newoutput += $line}
}
#Updates the script
Set-Content -Value $newoutput -Path $script.FullPath
}
}
} # End of process
} # End of function