This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################# | |
# iLO Bulk SSL Generation & Installation Script | |
# Written by Ben Short | |
# Modified by Markus Kraus | |
# Version 3.1, September 2015 | |
# | |
# Released under Creative Commons BY,SA | |
# http://creativecommons.org.au/learn/licences/ | |
# | |
# Script enumerates iLO devices from text file and generates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ESXiHostList = Get-VMHost | |
$syslog = "udp://syslog.test.lan:514" | |
$NTP1 = "192.168.2.1" | |
$NTP2 = "192.168.2.2" | |
foreach ($ESXiHost in $ESXiHostList) | |
{ | |
#Enable SSH and disable SSH Warning | |
$SSHService = $ESXiHost | Get-VMHostService | where {$_.Key -eq 'TSM-SSH'} | |
Start-VMHostService -HostService $SSHService -Confirm:$false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load VMware Snapin (if not already loaded) | |
if (!(Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue)) { | |
if (!(Add-PSSnapin -PassThru VMware.VimAutomation.Core)) { | |
# Error out if loading fails | |
Write-Error "ERROR: Cannot load the VMware Snapin. Is the PowerCLI installed?" | |
Exit | |
} | |
} | |
# Start Global Definitions | |
$vSwitches = New-Object System.Collections.ArrayList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start Load VMware Snapin (if not already loaded) | |
if (!(Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue)) { | |
if (!(Add-PSSnapin -PassThru VMware.VimAutomation.Core)) { | |
# Error out if loading fails | |
Write-Error "ERROR: Cannot load the VMware Snapin. Is the PowerCLI installed?" | |
Exit | |
} | |
} | |
# End Load VMware Snapin (if not already loaded) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($log in (get-eventlog -list).Log) { | |
clear-eventlog -log $log | |
} | |
# Alternative way | |
$logs = get-eventlog -list; $logs.foreach{clear-eventlog -log $_.Log} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load ImageBuilder Snapin (if not already loaded) | |
if (!(Get-PSSnapin -name VMware.ImageBuilder -ErrorAction:SilentlyContinue)) { | |
if (!(Add-PSSnapin -PassThru VMware.ImageBuilder)) { | |
# Error out if loading fails | |
write-host "`nFATAL ERROR: Cannot load the ImageBuilder Snapin. Is the PowerCLI installed?`n" | |
exit | |
} | |
} | |
cls | |
# Definde Global |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!(get-pssnapin -name VMware.VimAutomation.Core -erroraction silentlycontinue)) { | |
add-pssnapin VMware.VimAutomation.Core | |
} | |
$i = 1 | |
$GCred = Get-Credential | |
$VMtoProcess = Get-VM -Name MY-VEEAM-01 | |
Write-Host -foregroundcolor DarkGreen -backgroundcolor white "vSphere Network Config of the VM:" | |
$VMtoProcess | Get-NetworkAdapter | Select Parent, NetworkName, MacAddress | ft -AutoSize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing the CSV-file containing the NIC configuration. | |
$NICs = Import-Csv "C:\Scripts\NICs.csv" | Where-Object {$_.computername -eq $env:COMPUTERNAME} | |
foreach ($NIC in $NICs) { | |
$NetAdapter = Get-NetAdapter | Where-Object {$_.MacAddress -eq $NIC.MAC} | |
if ($NetAdapter) { | |
Write-Verbose "Found NIC $($NIC.NIC)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################# | |
# VM Hardening Script | |
# Written by Markus Kraus | |
# Version 1.2 | |
# | |
# http://mycloudrevolution.com/ | |
# | |
# Changelog: | |
# 2016.01 ver 1.0 Base Release | |
# 2016.02 ver 1.1 Added more Error Handling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var VcVMConfigSpec = new VcVirtualMachineConfigSpec(); | |
var changeValue = new Array(); | |
System.log ("Config From Array:"); | |
for (var i = 0; i < VcVmConfig.length; i++) { | |
System.log ("Name: " + VcVmConfig[i].key + " - " + "Value: " + VcVmConfig[i].value); | |
changeValue[i] = new VcOptionValue(); | |
changeValue[i].key = VcVmConfig[i].key; | |
changeValue[i].value = VcVmConfig[i].value; | |
} |
OlderNewer