Skip to content

Instantly share code, notes, and snippets.

@davelee212
davelee212 / fix-missing-cdrom.ps1
Last active September 2, 2016 07:36
fix-missing-cdrom.ps1
# A quick fix to ensure all VMs in a Resource Pool have a CD-ROM attached. This was written specifically
# to deal with a problem with VMs failed over by Zerto which do not have CD-ROM drives.
# Example:
# Connect to vCenter server and run this bit of code. Substitute in your own resource pool.
$VMs = Get-ResourcePool | where {$_.Name -like "My Resource Pool"} | Get-VM
foreach ($vm in $VMs) {
if (-NOT ($vm | Get-CDDrive) ) {
@davelee212
davelee212 / import-vse-fw-rules.ps1
Last active September 29, 2020 13:02
import-vse-fw-rules.ps1
# Run from a PowerCLI shell that has been logged into the vCloud Director instance using “Connect-CIServer -server url”
# and then run the script passing the following parameters:
# -file or -f = The CSV file containing the rules to import
# -edge or -e = The Edge Gateway Name
#
# Example:
# ./import-vse-fw-rules.ps1 -f myfwrules.csv -e “My vShield Edge”
param (
[parameter(Mandatory = $true, HelpMessage="Edge Gateway Name")][alias("-edge","e")][ValidateNotNullOrEmpty()][string[]]$egwname,
@davelee212
davelee212 / export-vse-fw-rules.ps1
Last active May 9, 2019 16:50
export-vse-fw-rules.ps1
# Run from a PowerCLI shell that has been logged into the vCloud Director instance using “Connect-CIServer -server url”
# and then run the script passing the following parameters:
# -file or -f = The CSV file to export rules to
# -edge or -e = The Edge Gateway Name
#
# Example:
# ./export-vse-fw-rules.ps1 -f myfwrules.csv -e “My vShield Edge”
#
param (
@davelee212
davelee212 / import-vse-nat-rules.ps1
Last active November 3, 2016 21:12
import-vse-nat-rules.ps1
# Run from a PowerCLI shell that has been logged into the vCloud Director instance using “Connect-CIServer -server url”
# and then run the script passing the following parameters:
# -file or -f = The CSV file to import rules from
# -edge or -e = The Edge Gateway Name to import rules into
# Example:
# ./import-vse-nat-rules.ps1 -f mynatrules.csv -e “My vShield Edge”
param (
@davelee212
davelee212 / export-vse-nat-rules.ps1
Last active November 3, 2016 21:12
export-vse-nat-rules.ps1
# Run from a PowerCLI shell that has been logged into the vCloud Director instance using “Connect-CIServer -server url”
# and then run the script passing the following parameters:
# -file or -f = The CSV file to export rules to
# -edge or -e = The Edge Gateway Name
# Example:
# ./export-vse-nat-rules.ps1 -f mynatrules.csv -e “My vShield Edge”
param (
[parameter(Mandatory = $true, HelpMessage="Edge Gateway Name")][alias("-edge","e")][ValidateNotNullOrEmpty()][string[]]$egwname,