Skip to content

Instantly share code, notes, and snippets.

View vMarkusK's full-sized avatar

Markus Kraus vMarkusK

View GitHub Profile
@vMarkusK
vMarkusK / ESXi-Image_v2.ps1
Last active February 9, 2016 14:57
Creates a ESXi Image from Online Depot and adds additional packages
# 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
@vMarkusK
vMarkusK / Align-NetworkName-Uni.ps1
Created February 9, 2016 16:16
Set Windows Network Name by MAC from CSV
# 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)"
@vMarkusK
vMarkusK / vm-hardening_v1.0.js
Created February 12, 2016 09:17
VMware vRO Scriptable Task for VM Hardening
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;
}
@vMarkusK
vMarkusK / Get-3parSpace.ps1
Created February 16, 2016 16:47
HP 3PAR PS Toolkit Extend
#############################################################################
# HP 3PAR PS Extend
# Written by Markus Kraus
# Version 1.0
#
# https://mycloudrevolution.wordpress.com/
#
# Changelog:
# 2016.02 ver 1.0 Base Release
#
@vMarkusK
vMarkusK / HP-3PAR-vSphere-Report_V1.2.ps1
Last active February 16, 2016 16:48
Reports HP 3PAR VVs and vSphere Datstores
#############################################################################
# 3Par Reporting
# Written by Markus Kraus
# Version 1.2
#
# https://mycloudrevolution.wordpress.com/
#
# Changelog:
# 2016.01 ver 1.0 Base Release
# 2016.02 ver 1.1 Added more CPG Details / Changed VV Space Calculation
@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
$ESXiHostList = Get-VMHost
foreach ($ESXiHost in $ESXiHostList)
{
#Configure HP 3PAR SATP/PSP Rule
$SATPesxcli = $ESXiHost | Get-EsxCli
$SATPesxcli.storage.nmp.satp.rule.add($null,"tpgs_on","3PAR custom rule",$null,$null,$null,"VV",$null,"VMW_PSP_RR","iops=100","VMW_SATP_ALUA",$null,$null,"3PARdata")
Write-Host $ESXiHost ": HP 3PAR SATP/PSP Rule, configured."
#Disable ATS HB (http://kb.vmware.com/kb/2113956)
@vMarkusK
vMarkusK / vCheck VM-DiskReport_IOPS-Limit.ps1
Last active March 6, 2016 10:03
vCheck Plugin to report vSphere VM disks related to Datastores and Max IOPs
# Start of Settings
# Bronze Limit
[int]$B_Limit = "250"
# Silber Limit
[int]$S_Limit = "1000"
# Gold Limit
[int]$G_Limit = "-1"
# VM IOPS Limits, do not report on any VMs who are defined here
$VMTDoNotInclude = "VM01*|VM01*"
# End of Settings
@vMarkusK
vMarkusK / syslog.bat
Last active March 11, 2016 08:43
HP Data Protector Syslog Integration
@ECHO OFF
setlocal
:: global variables
set log=D:\syslog\sessions.log
set maxbytesize=1000
:: cleanup logic
IF NOT EXIST "%log%" GOTO :Write
FOR /F "usebackq" %%A IN ('%log%') DO set size=%%~zA
@vMarkusK
vMarkusK / PRTG-vCenter.ps1
Last active April 4, 2016 14:44
Advanced Sensor will Report vCenter Statistics about Resource usage.
<#
.SYNOPSIS
PRTG vCenter Advanced Sensor
.DESCRIPTION
Advanced Sensor will Report vCenter Statistics about Resource usage.
.EXAMPLE
PRTG-vCenter.ps1 -VIServer vCenter.lan.local -Check DS