Reorganizational Update
Reorganizing of the repo for better, more streamlined access
This commit is contained in:
36
Scripts/Check-VMwareTools.ps1
Normal file
36
Scripts/Check-VMwareTools.ps1
Normal file
@@ -0,0 +1,36 @@
|
||||
function Check-Tools {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created by: Brian Graf
|
||||
Organization: VMware
|
||||
Official Blog: blogs.vmware.com/PowerCLI
|
||||
Personal Blog: www.vtagion.com
|
||||
Twitter: @vBrianGraf
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
This will quickly return all VMs that have VMware Tools out of date
|
||||
Along with the version that it is running
|
||||
.Example
|
||||
Check-Tools -VMs (Get-VM)
|
||||
.Example
|
||||
$SampleVMs = Get-VM "Mgmt*"
|
||||
Check-Tools -VMs $SampleVMs
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$True,
|
||||
Position=0)]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]
|
||||
$VMs
|
||||
)
|
||||
Process {
|
||||
#foreach ($VM in $VMs) {
|
||||
$OutofDate = $VMs | where {$_.ExtensionData.Guest.ToolsStatus -ne "toolsOk"}
|
||||
$Result = @($OutofDate | select Name,@{Name="ToolsVersion";Expression={$_.ExtensionData.Guest.Toolsversion}})
|
||||
|
||||
$Result
|
||||
}
|
||||
|
||||
}
|
||||
65
Scripts/ExportImportTags.ps1
Normal file
65
Scripts/ExportImportTags.ps1
Normal file
@@ -0,0 +1,65 @@
|
||||
function Export-Tag {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $True, Position = 1)]
|
||||
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server,
|
||||
|
||||
[Parameter(Mandatory = $True, Position = 2)]
|
||||
[string]$Destination
|
||||
)
|
||||
|
||||
# Retrieve all categories
|
||||
$categoryList = Get-TagCategory -Server $server
|
||||
# Retrieve all tags
|
||||
$tagList = Get-Tag -Server $server
|
||||
# Store the tags and categories in a list to export them at once
|
||||
$export = @($categoryList, $tagList)
|
||||
# Export the tags and categories to the specified destination
|
||||
Export-Clixml -InputObject $export -Path $destination
|
||||
}
|
||||
|
||||
function Import-Tag {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
[Parameter(Mandatory = $True, Position = 1)]
|
||||
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server,
|
||||
|
||||
[Parameter(Mandatory = $True, Position = 2)]
|
||||
[string]$Source
|
||||
)
|
||||
|
||||
# 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 += `
|
||||
New-TagCategory `
|
||||
-Name $category.Name `
|
||||
-Description $category.Description `
|
||||
-Cardinality $category.Cardinality `
|
||||
-EntityType $category.EntityType `
|
||||
-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 `
|
||||
-Category $category `
|
||||
-Server $server `
|
||||
| Out-Null
|
||||
}
|
||||
}
|
||||
42
Scripts/Get-BiosBootStatus.ps1
Normal file
42
Scripts/Get-BiosBootStatus.ps1
Normal file
@@ -0,0 +1,42 @@
|
||||
function Get-BiosBootStatus {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created by: Brian Graf
|
||||
Organization: VMware
|
||||
Official Blog: blogs.vmware.com/PowerCLI
|
||||
Personal Blog: www.vtagion.com
|
||||
Twitter: @vBrianGraf
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
This will return the boot status of Virtual Machines, whether they
|
||||
are booting to the Guest OS or being forced to boot into BIOS.
|
||||
.Example
|
||||
# Returns all VMs and where they are booting
|
||||
Get-BiosBootStatus -VMs (Get-VM)
|
||||
.Example
|
||||
# Only returns VMs that are booting to BIOS
|
||||
Get-BiosBootStatus (Get-VM) -IsSetup
|
||||
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$True,
|
||||
Position=0)]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]
|
||||
$VM,
|
||||
[switch]$IsSetup
|
||||
)
|
||||
Process {
|
||||
if($IsSetup)
|
||||
{
|
||||
$Execute = $VM | where {$_.ExtensionData.Config.BootOptions.EnterBiosSetup -eq "true"} | Select Name,@{Name="EnterBiosSetup";Expression={$_.ExtensionData.config.BootOptions.EnterBiosSetup}}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Execute = $VM | Select Name,@{Name="EnterBiosSetup";Expression={$_.ExtensionData.config.BootOptions.EnterBiosSetup}}
|
||||
}
|
||||
}
|
||||
End {$Execute}
|
||||
}
|
||||
10660
Scripts/Host_Memory_Assessment_Tool_v2a.ps1
Normal file
10660
Scripts/Host_Memory_Assessment_Tool_v2a.ps1
Normal file
File diff suppressed because it is too large
Load Diff
108
Scripts/Install-HostClient.ps1
Normal file
108
Scripts/Install-HostClient.ps1
Normal file
@@ -0,0 +1,108 @@
|
||||
function install-HostClient {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created on: 8/13/2015 9:12 AM
|
||||
Created by: Brian Graf
|
||||
Github: http://www.github.com/vtagion
|
||||
Twitter: @vBrianGraf
|
||||
Website: http://www.vtagion.com
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
This advanced function will allow you to install the ESXi Host Client
|
||||
On all the hosts in a specified cluster.
|
||||
.Example
|
||||
Install-HostClient -Cluster (Get-Cluster Management-CL) -Datastore (Get-Datastore NFS-SAS-300GB-A) -vibfullpath c:\temp\esxui-2976804.vib
|
||||
|
||||
.Example
|
||||
$ds = Get-Datastore Main-shared
|
||||
$Cluster = Main-CL
|
||||
Install-HostClient -Cluster $cluster -Datastore $ds -vibfullpath c:\temp\esxui-2976804.vib
|
||||
|
||||
.Notes
|
||||
You must use shared storage for this to work correctly, otherwise only a single host will be able to install the vib and all others will fail
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true,HelpMessage="Must be shared storage across all hosts")]
|
||||
[ValidateScript({Get-Datastore $_})]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl]$Datastore,
|
||||
|
||||
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true,HelpMessage="Please specify a Cluster object")]
|
||||
[ValidateScript({Get-Cluster $_})]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.ComputeResourceImpl]$Cluster,
|
||||
|
||||
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true,HelpMessage="Specify the full path of the ESXi Host Client Vib")]
|
||||
[ValidateScript({Get-Item $_})]
|
||||
[String]$vibfullpath
|
||||
)
|
||||
Begin {
|
||||
|
||||
$VIBFile = Get-item $vibfullpath -ErrorAction SilentlyContinue
|
||||
|
||||
# Verify that VIB location is correct
|
||||
if ($VIBFile -eq $null){Throw "oops! looks like $VIBFile doesn't exist in this location."}
|
||||
|
||||
# Save filename to variable
|
||||
$VIBFilename = $vibfile.PSChildname
|
||||
|
||||
# Save datacenter to variable for Datastore path
|
||||
$dc = $Cluster | Get-Datacenter
|
||||
|
||||
#Get-Datastore -Name $Datastore
|
||||
|
||||
# Create Datastore Path string
|
||||
$Datastorepath = "vmstore:\" + $dc + "\" + $Datastore.Name + "\"
|
||||
|
||||
# Verbose info for debugging
|
||||
Write-verbose "DatastorePath = $Datastorepath"
|
||||
Write-verbose "Vibfile = $vibfile"
|
||||
Write-verbose "Vibfullpath = $vibfullpath"
|
||||
Write-verbose "VibFilename = $VIBFilename"
|
||||
|
||||
# check to see if file already exists or not before copying
|
||||
if (!(Test-Path -Path $Datastorepath)) {
|
||||
Copy-DatastoreItem $vibfile $Datastorepath -Force
|
||||
}
|
||||
|
||||
# validate the copy worked. If not, stop script
|
||||
if (!(Test-Path -Path $Datastorepath)) {
|
||||
Throw "Looks like the VIB did not copy to $Datastorepath. Check the filename and datastore path again and rerun this function."
|
||||
}
|
||||
|
||||
# Create VIB path string for ESXCLI
|
||||
$VIBPATH = "/vmfs/volumes/" + $datastore.name + "/" + "$VIBFilename"
|
||||
|
||||
}
|
||||
|
||||
Process {
|
||||
|
||||
|
||||
#$VIBPATH = "/vmfs/volumes/NFS-SAS-300GB-A/esxui-2976804.vib"
|
||||
|
||||
# Get each host in specified cluster that meets criteria
|
||||
Get-VMhost -Location $Cluster | where { $_.PowerState -eq "PoweredOn" -and $_.ConnectionState -eq "Connected" } | foreach {
|
||||
|
||||
Write-host "Preparing $($_.Name) for ESXCLI" -ForegroundColor Yellow
|
||||
|
||||
# Create ESXCLI variable for host for actions
|
||||
$ESXCLI = Get-EsxCli -VMHost $_
|
||||
|
||||
# Check to see if ESX-UI is already installed
|
||||
if (($ESXCLI.software.vib.list() | Select AcceptanceLevel,ID,InstallDate,Name,ReleaseDate,Status,Vendor,Version | Where {$_.Name -match "esx-ui"})) {Write-host "It appears ESX-UI is already installed on $_. Skipping..." -ForegroundColor Yellow} else {
|
||||
|
||||
Write-host "Installing ESXi Embedded Host Client on $($_.Name)" -ForegroundColor Yellow
|
||||
|
||||
# Saving command to variable to use for verification after command is run
|
||||
$action = $ESXCLI.software.vib.install($null,$null,$null,$null,$null,$null,$null,$null,$VIBPATH)
|
||||
|
||||
# Verify VIB installed successfully
|
||||
if ($action.Message -eq "Operation finished successfully."){Write-host "Action Completed successfully on $($_.Name)" -ForegroundColor Green} else {Write-host $action.Message -ForegroundColor Red}
|
||||
}
|
||||
}
|
||||
}
|
||||
End {
|
||||
Write-host "Function Complete" -ForegroundColor Green
|
||||
Write-Host "You may access your hosts at https://<host ipaddress>/ui" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
55
Scripts/Invoke-BiosBoot.ps1
Normal file
55
Scripts/Invoke-BiosBoot.ps1
Normal file
@@ -0,0 +1,55 @@
|
||||
function Invoke-BiosBoot {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created by: Brian Graf
|
||||
Organization: VMware
|
||||
Official Blog: blogs.vmware.com/PowerCLI
|
||||
Personal Blog: www.vtagion.com
|
||||
Twitter: @vBrianGraf
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
This function allows you to set a VM to boot into BIOS or Guest OS
|
||||
.Example
|
||||
# Set a VM to boot to BIOS
|
||||
Invoke-BiosBoot -VMs (Get-VM) -Bios
|
||||
.Example
|
||||
Invoke-BiosBoot -VMs (Get-VM) -OS
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$True,
|
||||
Position=0)]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]
|
||||
$VM,
|
||||
[switch]$Bios,
|
||||
[switch]$OS
|
||||
)
|
||||
Process {
|
||||
if($Bios)
|
||||
{
|
||||
Foreach ($VirtualMachine in $VM) {
|
||||
$object = New-Object VMware.Vim.VirtualMachineConfigSpec
|
||||
$object.bootOptions = New-Object VMware.Vim.VirtualMachineBootOptions
|
||||
$object.bootOptions.enterBIOSSetup = $true
|
||||
|
||||
$Reconfigure = $VirtualMachine | Get-View
|
||||
$Reconfigure.ReconfigVM_Task($object)
|
||||
$Return
|
||||
}
|
||||
}
|
||||
if($OS)
|
||||
{
|
||||
Foreach ($VirtualMachine in $VM) {
|
||||
$object = New-Object VMware.Vim.VirtualMachineConfigSpec
|
||||
$object.bootOptions = New-Object VMware.Vim.VirtualMachineBootOptions
|
||||
$object.bootOptions.enterBIOSSetup = $false
|
||||
|
||||
$Reconfigure = $VirtualMachine | Get-View
|
||||
$Reconfigure.ReconfigVM_Task($object)
|
||||
$Return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/README.md
Normal file
1
Scripts/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Sample Scripts
|
||||
51
Scripts/Remove-HostClient.ps1
Normal file
51
Scripts/Remove-HostClient.ps1
Normal file
@@ -0,0 +1,51 @@
|
||||
function Remove-HostClient {
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created on: 8/13/2015 9:12 AM
|
||||
Created by: Brian Graf
|
||||
Github: http://www.github.com/vtagion
|
||||
Twitter: @vBrianGraf
|
||||
Website: http://www.vtagion.com
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
This advanced function will allow you to remove the ESXi Host Client
|
||||
on all the hosts in a specified cluster.
|
||||
.Example
|
||||
Remove-HostClient -Cluster (Get-Cluster Management-CL)
|
||||
|
||||
.Example
|
||||
$Cluster = Main-CL
|
||||
Remove-HostClient -Cluster $cluster
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateScript({Get-Cluster $_})]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.ComputeResourceImpl]$Cluster
|
||||
)
|
||||
Process {
|
||||
|
||||
# Get all ESX hosts in cluster that meet criteria
|
||||
Get-VMhost -Location $Cluster | where { $_.PowerState -eq "PoweredOn" -and $_.ConnectionState -eq "Connected" } | foreach {
|
||||
|
||||
Write-host "Preparing to remove Host Client from $($_.Name)" -ForegroundColor Yellow
|
||||
|
||||
# Prepare ESXCLI variable
|
||||
$ESXCLI = Get-EsxCli -VMHost $_
|
||||
|
||||
# Check to see if VIB is installed on the host
|
||||
if (($ESXCLI.software.vib.list() | Where {$_.Name -match "esx-ui"})) {
|
||||
|
||||
Write-host "Removing ESXi Embedded Host Client on $($_.Name)" -ForegroundColor Yellow
|
||||
|
||||
# Command saved to variable for future verification
|
||||
$action = $esxcli.software.vib.remove($null,$null,$null,$null,"esx-ui")
|
||||
|
||||
# Verify VIB removed successfully
|
||||
if ($action.Message -eq "Operation finished successfully."){Write-host "Action Completed successfully on $($_.Name)" -ForegroundColor Green} else {Write-host $action.Message -ForegroundColor Red}
|
||||
|
||||
} else { Write-host "It appears Host Client is not installed on this host. Skipping..." -ForegroundColor Yellow }
|
||||
}
|
||||
}
|
||||
End {Write-host "Function complete" -ForegroundColor Green}
|
||||
}
|
||||
38
Scripts/Remove-IPPool.ps1
Normal file
38
Scripts/Remove-IPPool.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
Function Remove-IPPool {
|
||||
<#
|
||||
.Synopsis
|
||||
This function will remove IP-Pools from vCenter
|
||||
.Description
|
||||
This function will remove IP-Pools from vCenter based on the inputs provided
|
||||
.Example
|
||||
Assuming my datacenter was 'westwing' and my IPPool was 'IPPool1'
|
||||
remove-ippool westwing IPPool1
|
||||
.Notes
|
||||
Author: Brian Graf
|
||||
Role: Technical Marketing Engineer, VMware
|
||||
Last Edited: 05/01/2014
|
||||
|
||||
#>
|
||||
[cmdletbinding()]
|
||||
Param (
|
||||
[Parameter(ValueFromPipeline = $true, valuefrompipelinebypropertyname = $true)]
|
||||
[String]$Datacenter,
|
||||
[Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
|
||||
[String]$PoolName
|
||||
)
|
||||
|
||||
Process {
|
||||
$dc = (Get-datacenter $Datacenter)
|
||||
$dcenter = New-Object VMware.Vim.ManagedObjectReference
|
||||
$dcenter.type = $dc.ExtensionData.moref.type
|
||||
$dcenter.Value = $dc.ExtensionData.moref.value
|
||||
|
||||
$IPPoolManager = Get-View -Id 'IpPoolManager'
|
||||
$SelectedPool = ($IPPoolManager.QueryIpPools($dc.ID) | Where-Object { $_.Name -like $PoolName })
|
||||
|
||||
$IPPool = Get-View -Id 'IpPoolManager-IpPoolManager'
|
||||
$IPPool.DestroyIpPool($dcenter, $SelectedPool.id, $true)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
107
Scripts/Set-LockdownLevel_v1a.ps1
Normal file
107
Scripts/Set-LockdownLevel_v1a.ps1
Normal file
@@ -0,0 +1,107 @@
|
||||
function Set-LockdownLevel {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Set the Lockdown Level of ESX Hosts if PowerCLI connected to vCenter Server
|
||||
.PARAMETER VMHost
|
||||
The target ESX host
|
||||
.PARAMETER Disabled
|
||||
Sets the Lockdown level to Disabled
|
||||
.PARAMETER Normal
|
||||
Sets the Lockdown level to Normal
|
||||
.PARAMETER Strict
|
||||
Sets the Lockdown level to Strict
|
||||
.PARAMETER SuppressWarning
|
||||
Removes the messagebox popup verifying you want to proceed
|
||||
.EXAMPLE
|
||||
Set the Lockdown level to Normal on Host 10.144.99.231
|
||||
Set-LockdownLevel -VMhost 10.144.99.231 -Normal
|
||||
.EXAMPLE
|
||||
Set all ESX hosts Lockdown level to Disabled
|
||||
Get-VMhost | foreach { Set-LockdownLevel $_ -Disabled }
|
||||
.EXAMPLE
|
||||
Sets all ESX hosts Lockdown level to Normal and saves data to CSV, Suppresses warning
|
||||
Get-VMhost | foreach { Set-LockdownLevel $_ -filepath c:\temp\lockdowndata.csv -Disabled -SuppressWarning }
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created on: 3/13/2015 5:55 AM
|
||||
Created by: Brian Graf
|
||||
Twitter: @vBrianGraf
|
||||
Email: grafb@vmware.com
|
||||
THIS SCRIPT IS NOT OFFICIALLY SUPPORTED BY VMWARE. USE AT YOUR OWN RISK
|
||||
===========================================================================
|
||||
#>
|
||||
|
||||
[CmdletBinding(DefaultParametersetName="Disabled")]
|
||||
Param(
|
||||
[Parameter(Mandatory=$True,Position=1,ValueFromPipeline=$True)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$VMhost,
|
||||
|
||||
[Parameter(Mandatory=$False)]
|
||||
[string]$filePath,
|
||||
|
||||
[Parameter(ParameterSetName='Disabled')]
|
||||
[switch]$Disabled,
|
||||
|
||||
[Parameter(ParameterSetName='Normal')]
|
||||
[switch]$Normal,
|
||||
|
||||
[Parameter(ParameterSetName='Strict')]
|
||||
[switch]$Strict,
|
||||
|
||||
[switch]$SuppressWarning
|
||||
)
|
||||
|
||||
Process {
|
||||
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
|
||||
$Actions = @()
|
||||
|
||||
#Create an object to store changes and information in
|
||||
$Historical = New-Object -TypeName PSObject
|
||||
|
||||
#Specify the Three parameters to be used
|
||||
switch ($PsCmdlet.ParameterSetName) {
|
||||
"Disabled" {$level = "lockdownDisabled"}
|
||||
"Normal" {$level = "lockdownNormal"}
|
||||
"Strict" {$level = "lockdownStrict"}
|
||||
}
|
||||
Write-Host "you are changing the lockdown mode on host [$VMHost] to $level" -ForegroundColor Yellow
|
||||
if ((!($SuppressWarning)) -and ($level -ne "lockdownDisabled")) {
|
||||
|
||||
$OUTPUT = [System.Windows.Forms.MessageBox]::Show("By changing the Lockdown Mode level you may be locking yourself out of your host. If you understand the risks and would like to continue, click YES. If you wish to Cancel, click NO." , "CAUTION" , 4)
|
||||
|
||||
if ($OUTPUT -eq "NO" )
|
||||
{
|
||||
|
||||
Throw "User Aborted Lockdown Mode Level Change"
|
||||
|
||||
}
|
||||
}
|
||||
#If a Filepath was given, echo that it will save the info to CSV
|
||||
if ($Filepath) {
|
||||
Write-Host "Saving current Lockdown Mode level to CSV" -ForegroundColor Yellow}
|
||||
|
||||
#Retrieve the VMhost as a view object
|
||||
$lockdown = Get-View (Get-View -ViewType HostSystem -Filter @{"Name"="$VMHost"}).ConfigManager.HostAccessManager
|
||||
|
||||
#Add info to our object
|
||||
$Historical | Add-Member -MemberType NoteProperty -Name Timestamp -Value (Get-Date -Format g)
|
||||
$Historical | Add-Member -MemberType NoteProperty -Name Host -Value $VMhost
|
||||
$Historical | Add-Member -MemberType NoteProperty -Name OriginalValue -Value $lockdown.LockdownMode
|
||||
|
||||
#Perform Lockdown Mode change
|
||||
$lockdown.ChangeLockdownMode($level)
|
||||
|
||||
#Refresh View data
|
||||
$lockdown.UpdateViewData()
|
||||
|
||||
#Verify change happened
|
||||
if ($lockdown.LockdownMode -eq $level) {
|
||||
Write-Host "Lockdown Mode Level Updated Successfully on host [$VMHost]" -ForegroundColor Green} else {Write-Host "Uh Oh... Looks like the Lockdown Mode Level did not update for host [$VMHost]" -ForegroundColor Red}
|
||||
$Historical | Add-Member -MemberType NoteProperty -Name NewValue -Value $lockdown.LockdownMode
|
||||
$Actions += $Historical
|
||||
|
||||
#Export to CSV if filepath was given
|
||||
if ($filePath) {$Actions | Export-Csv "$filePath" -NoTypeInformation -NoClobber -Append}
|
||||
}
|
||||
}
|
||||
BIN
Scripts/Sysprep_Automation_Script_v1a.ps1
Normal file
BIN
Scripts/Sysprep_Automation_Script_v1a.ps1
Normal file
Binary file not shown.
Reference in New Issue
Block a user