Skip to content

Instantly share code, notes, and snippets.

View vMarkusK's full-sized avatar

Markus Kraus vMarkusK

View GitHub Profile
@vMarkusK
vMarkusK / Clear-Eventlog.ps1
Last active July 12, 2016 20:40
Clears the whole Windows Eventlog
foreach ($log in (get-eventlog -list).Log) {
clear-eventlog -log $log
}
# Alternative way
$logs = get-eventlog -list; $logs.foreach{clear-eventlog -log $_.Log}
@vMarkusK
vMarkusK / scsi-unmap.ps1
Last active June 2, 2017 15:08
Runs VAAI UNMAP on a group of VMware Datastores
# 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)
@vMarkusK
vMarkusK / PortGroup-Creator.ps1
Last active July 12, 2016 20:57
Creates PortGroups on Standard vSwitches on all Hosts in a vSphere Cluster
# 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
@vMarkusK
vMarkusK / esxi-Base-konfig-10.ps1
Last active February 20, 2016 17:58
ESXi Basis-Konfiguration mit HP 3PAR
$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
@vMarkusK
vMarkusK / iLOSignCertv2-31.ps1
Created January 27, 2016 12:26
HP iLO bulk SSL Generation & Installation via PowerShell
#############################################################################
# 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