This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder