License PowerCLI-Examples-Scripts repository under BSD-2 Clause (#462)
As part of the VMware open source program, we have to update this repository with the correct license and copyright information. We add the BSD-2 Clause License for this repository. We mark all source code provided by VMware with the Copyright notice under BSD-2 Clause license. * Update repository license to BSD 2-Clause License * Update Copyright
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
function Get-VMEvcMode {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gathers information on the EVC status of a VM
|
||||
.DESCRIPTION
|
||||
.DESCRIPTION
|
||||
Will provide the EVC status for the specified VM
|
||||
.NOTES
|
||||
.NOTES
|
||||
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
|
||||
.PARAMETER Name
|
||||
VM name which the function should be ran against
|
||||
.EXAMPLE
|
||||
Get-VMEvcMode -Name vmName
|
||||
Retreives the EVC status of the provided VM
|
||||
Retreives the EVC status of the provided VM
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)]
|
||||
$Name
|
||||
@@ -33,7 +37,7 @@ function Get-VMEvcMode {
|
||||
|
||||
}
|
||||
elseif ($name -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]) {$evVM += $name}
|
||||
|
||||
|
||||
if ($evVM -eq $null) {Write-Warning "No VMs found."}
|
||||
else {
|
||||
$output = @()
|
||||
@@ -55,20 +59,20 @@ function Get-VMEvcMode {
|
||||
}
|
||||
|
||||
function Remove-VMEvcMode {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes the EVC status of a VM
|
||||
.DESCRIPTION
|
||||
.DESCRIPTION
|
||||
Will remove the EVC status for the specified VM
|
||||
.NOTES
|
||||
.NOTES
|
||||
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
|
||||
.PARAMETER Name
|
||||
VM name which the function should be ran against
|
||||
.EXAMPLE
|
||||
Remove-VMEvcMode -Name vmName
|
||||
Removes the EVC status of the provided VM
|
||||
Removes the EVC status of the provided VM
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)]
|
||||
$Name
|
||||
@@ -90,7 +94,7 @@ function Remove-VMEvcMode {
|
||||
|
||||
}
|
||||
elseif ($name -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]) {$evVM += $name}
|
||||
|
||||
|
||||
if ($evVM -eq $null) {Write-Warning "No VMs found."}
|
||||
else {
|
||||
foreach ($v in $evVM) {
|
||||
@@ -99,17 +103,17 @@ function Remove-VMEvcMode {
|
||||
|
||||
$v.ExtensionData.ApplyEvcModeVM_Task($null, $true) | Out-Null
|
||||
$updateVM += $v.Name
|
||||
|
||||
|
||||
}
|
||||
else {Write-Warning $v.Name + " does not have the minimum requirements of being Hardware Version 14 and powered off."}
|
||||
|
||||
}
|
||||
|
||||
if ($updateVM) {
|
||||
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
Get-VMEvcMode -Name $updateVM
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,12 +123,12 @@ function Remove-VMEvcMode {
|
||||
}
|
||||
|
||||
function Set-VMEvcMode {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures the EVC status of a VM
|
||||
.DESCRIPTION
|
||||
.DESCRIPTION
|
||||
Will configure the EVC status for the specified VM
|
||||
.NOTES
|
||||
.NOTES
|
||||
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
|
||||
.PARAMETER Name
|
||||
VM name which the function should be ran against
|
||||
@@ -134,7 +138,7 @@ function Set-VMEvcMode {
|
||||
Set-VMEvcMode -Name vmName -EvcMode intel-sandybridge
|
||||
Configures the EVC status of the provided VM to be 'intel-sandybridge'
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)]
|
||||
$Name,
|
||||
@@ -159,7 +163,7 @@ function Set-VMEvcMode {
|
||||
|
||||
}
|
||||
elseif ($name -is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]) {$evVM += $name}
|
||||
|
||||
|
||||
if ($evVM -eq $null) {Write-Warning "No VMs found."}
|
||||
else {
|
||||
|
||||
@@ -172,17 +176,17 @@ function Set-VMEvcMode {
|
||||
|
||||
$v.ExtensionData.ApplyEvcModeVM_Task($evcMask, $true) | Out-Null
|
||||
$updateVM += $v.Name
|
||||
|
||||
|
||||
}
|
||||
else {Write-Warning $v.Name + " does not have the minimum requirements of being Hardware Version 14 and powered off."}
|
||||
|
||||
}
|
||||
|
||||
if ($updateVM) {
|
||||
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
Get-VMEvcMode -Name $updateVM
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user