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,4 +1,9 @@
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
|
||||
<#
|
||||
.SYNOPSIS Retrieve the current VMFS Unmap priority for VMFS 6 datastore
|
||||
.NOTES Author: William Lam
|
||||
.NOTES Site: www.virtuallyghetto.com
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
function Check-Tools {
|
||||
<#
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
function Check-Tools {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created by: Brian Graf
|
||||
@@ -18,14 +22,14 @@
|
||||
Check-Tools -VMs $SampleVMs
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
param(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$True,
|
||||
Position=0)]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]
|
||||
$VMs
|
||||
)
|
||||
Process {
|
||||
Process {
|
||||
#foreach ($VM in $VMs) {
|
||||
$OutofDate = $VMs | where {$_.ExtensionData.Guest.ToolsStatus -ne "toolsOk"}
|
||||
$Result = @($OutofDate | select Name,@{Name="ToolsVersion";Expression={$_.ExtensionData.Guest.Toolsversion}})
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
|
||||
function Get-DatastoreSIOCStatCollection {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gathers information on the status of SIOC statistics collection for a datastore
|
||||
.DESCRIPTION
|
||||
.DESCRIPTION
|
||||
Will provide the status on a datastore's SIOC statistics collection
|
||||
.NOTES
|
||||
.NOTES
|
||||
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
|
||||
.PARAMETER Datastore
|
||||
Datastore to be ran against
|
||||
.EXAMPLE
|
||||
Get-DatastoreSIOCStatCollection -Datastore ExampleDatastore
|
||||
Retreives the status of SIOC statistics collection for the provided datastore
|
||||
Retreives the status of SIOC statistics collection for the provided datastore
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)]
|
||||
$Datastore
|
||||
@@ -20,13 +25,13 @@ function Get-DatastoreSIOCStatCollection {
|
||||
|
||||
Process {
|
||||
|
||||
#Collect information about the desired datastore/s and verify existance
|
||||
#Collect information about the desired datastore/s and verify existance
|
||||
$ds = Get-Datastore $datastore -warningaction silentlycontinue -erroraction silentlycontinue
|
||||
if (!$ds) {Write-Warning -Message "No Datastore found"}
|
||||
else {
|
||||
|
||||
$report = @()
|
||||
|
||||
|
||||
#Loops through each datastore provided and feeds back information about the SIOC Statistics Collection status
|
||||
foreach ($item in $ds) {
|
||||
|
||||
@@ -36,7 +41,7 @@ function Get-DatastoreSIOCStatCollection {
|
||||
$report += $tempitem
|
||||
|
||||
}
|
||||
|
||||
|
||||
#Returns the output to the user
|
||||
return $report
|
||||
|
||||
@@ -48,20 +53,20 @@ function Get-DatastoreSIOCStatCollection {
|
||||
|
||||
|
||||
function Set-DatastoreSIOCStatCollection {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configures the status of SIOC statistics collection for a datastore
|
||||
.DESCRIPTION
|
||||
.DESCRIPTION
|
||||
Will modify the status on a datastore's SIOC statistics collection
|
||||
.NOTES
|
||||
.NOTES
|
||||
Author: Kyle Ruddy, @kmruddy, thatcouldbeaproblem.com
|
||||
.PARAMETER Datastore
|
||||
Datastore to be ran against
|
||||
.EXAMPLE
|
||||
Set-DatastoreSIOCStatCollection -Datastore ExampleDatastore -Enable
|
||||
Enables SIOC statistics collection for the provided datastore
|
||||
Enables SIOC statistics collection for the provided datastore
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,Position=0,ValueFromPipelineByPropertyName=$true)]
|
||||
$Datastore,
|
||||
@@ -97,7 +102,7 @@ function Set-DatastoreSIOCStatCollection {
|
||||
$_this.ConfigureDatastoreIORM_Task($dsobj.ExtensionData.MoRef,$spec) | out-null
|
||||
start-sleep -s 1
|
||||
$report += Get-View -Id $dsobj.ExtensionData.MoRef -Property Name,Iormconfiguration.statsCollectionEnabled | select Name,@{N='SIOCStatCollection';E={$_.Iormconfiguration.statsCollectionEnabled}}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#Returns the output to the user
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
|
||||
<#
|
||||
.SYNOPSIS Retrieve the installation date of an ESXi host
|
||||
.NOTES Author: William Lam
|
||||
.NOTES Site: www.virtuallyghetto.com
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
|
||||
<#
|
||||
.SYNOPSIS Retrieve the installation date of an ESXi host
|
||||
.NOTES Author: William Lam
|
||||
.NOTES Site: www.virtuallyghetto.com
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
function Export-Tag {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $True, Position = 1)]
|
||||
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server,
|
||||
|
||||
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server,
|
||||
|
||||
[Parameter(Mandatory = $True, Position = 2)]
|
||||
[string]$Destination,
|
||||
|
||||
|
||||
[Parameter(Mandatory = $False, Position = 3)]
|
||||
[boolean]$ExportAssignments
|
||||
)
|
||||
|
||||
|
||||
# Retrieve all categories
|
||||
$categoryList = Get-TagCategory -Server $server
|
||||
# Retrieve all tags
|
||||
@@ -30,24 +34,24 @@ function Import-Tag {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $True, Position = 1)]
|
||||
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server,
|
||||
|
||||
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server,
|
||||
|
||||
[Parameter(Mandatory = $True, Position = 2)]
|
||||
[string]$Source,
|
||||
|
||||
|
||||
[Parameter(Mandatory = $False, Position = 3)]
|
||||
[boolean]$ImportAssignments
|
||||
)
|
||||
|
||||
|
||||
# Import the tags and categories from the specified source
|
||||
$import = Import-Clixml -Path $source
|
||||
# Divide the input in separate lists for tags and categories
|
||||
$categoryList = $import[0]
|
||||
$tagList = $import[1]
|
||||
|
||||
|
||||
# Store the newly created categories to avoid retrieving them later
|
||||
$categories = @()
|
||||
|
||||
|
||||
# First create all categories on the server
|
||||
foreach ($category in $categoryList) {
|
||||
$categories += `
|
||||
@@ -59,13 +63,13 @@ function Import-Tag {
|
||||
-Server $server `
|
||||
| Out-Null
|
||||
}
|
||||
|
||||
|
||||
# Then create all tags in the corresponding categories
|
||||
foreach ($tag in $tagList) {
|
||||
# Find the category object in the list
|
||||
$category = $categories | where {$_.Name -eq $tag.Category.Name}
|
||||
if ($category -eq $null) {$category = $tag.Category.Name}
|
||||
|
||||
|
||||
New-Tag `
|
||||
-Name $tag.Name `
|
||||
-Description $tag.Description `
|
||||
@@ -73,7 +77,7 @@ function Import-Tag {
|
||||
-Server $server `
|
||||
| Out-Null
|
||||
}
|
||||
|
||||
|
||||
# Restore the assignments if selected
|
||||
If ($ImportAssignments) {
|
||||
# Check for assignments in the file
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
function Get-BiosBootStatus {
|
||||
<#
|
||||
<#
|
||||
Copyright 2021 VMware, Inc.
|
||||
SPDX-License-Identifier: BSD-2-Clause
|
||||
#>
|
||||
function Get-BiosBootStatus {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created by: Brian Graf
|
||||
@@ -17,10 +21,10 @@
|
||||
.Example
|
||||
# Only returns VMs that are booting to BIOS
|
||||
Get-BiosBootStatus (Get-VM) -IsSetup
|
||||
|
||||
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
param(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$True,
|
||||
Position=0)]
|
||||
|
||||
Reference in New Issue
Block a user