Skip to content

Instantly share code, notes, and snippets.

View vMarkusK's full-sized avatar

Markus Kraus vMarkusK

View GitHub Profile
$LogPath = "C:\inetpub\logs\LogFiles\W3SVC1\*"
$LogFiles = "*.log"
[int] $LogRetention = "-30" # in Days
Get-ChildItem $LogPath -Include $LogFiles -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays($LogRetention)} | Remove-Item
@vMarkusK
vMarkusK / Get-ClusterSLO.ps1
Created September 7, 2020 20:51
This VMware PowerCLI Script gathers the current SLIs of the given vSphere Cluster. The values are only a snapshot of the current state, no statistics are processed (so far).
function Get-ClusterSLO {
<#
.NOTES
===========================================================================
Created by: Markus Kraus
Twitter: @VMarkus_K
Private Blog: mycloudrevolution.com
===========================================================================
Changelog:
2020.08 ver 1.0 Base Release
@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
@vMarkusK
vMarkusK / minio.ps1
Created March 31, 2022 19:40
Quick and Dirty MinIO Service Setup on Windows OS
#Check script run as administrator
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
Set-Location -Path $PSScriptRoot
$ninioConolePort = 8443
$minioDataRoot = "C:\minioData"
foreach($i in 1..4){
New-Item -ItemType Directory -Path $minioDataRoot -Name $i
}
@vMarkusK
vMarkusK / REST API service for Veeam backup & Replication.postman_collection.json
Created November 9, 2020 21:07
REST API service for Veeam backup & Replication Postman Collection
This file has been truncated, but you can view the full file.
{
"info": {
"_postman_id": "3f100323-72de-47c0-a14a-ea11fcb692f4",
"name": "REST API service for Veeam backup & Replication",
"description": "REST API service for Veeam backup & Replication\n\nContact Support:\nEmail: support@veeam.com",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "api",
@vMarkusK
vMarkusK / PRTG-Veeam-SessionStats.ps1
Created February 29, 2016 13:43
PRTG Advanced Custom Sensor for VEEAM v9
$user = "yourUser"
$password = "yourPassword"
# POST - Authorization
$Auth = @{uri = "http://yourVEM.fqdn:9399/api/sessionMngr/?v=v1_2";
Method = 'POST'; #(or POST, or whatever)
Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($user):$($password)"));
} #end headers hash table
} #end $params hash table
@vMarkusK
vMarkusK / base.sh
Last active October 7, 2020 21:06
Prepate CentOS 8
hostname ansible01
dnf install -y epel-release
dnf upgrade -y
dnf install -y open-vm-tools python3 git
useradd ansible
su ansible
echo 'ansible ALL=(ALL) NOPASSWD:ALL' >> visudo
pip3 install --user ansible
@vMarkusK
vMarkusK / gpg.txt
Created February 26, 2020 20:41
GPG and GitHub
# Generate Key
$ gpg --gen-key
# List Keys
$ gpg --list-secret-keys --keyid-format LONG
# Show Public Key Block
$ gpg --armor --export F5900F8A49F4FB76
# Add Key to git Config
@vMarkusK
vMarkusK / ESXi-Depot-Install-ESXCLI.ps1
Created February 22, 2018 08:55
This PowerCLI Script Uploads and Installs a ESXi Depot Package via ESXCLI -v2
[String]$ClusterName = "Compute01"
[String]$LocalPath = "D:\Image\HPE-20180220.zip"
[String]$DepotName = "HPE-20180220.zip"
[String]$TempDatastoreName = "LOCAL*"
$VMhosts = Get-Cluster -Name $ClusterName | Get-VMHost | Where-Object {$_.ConnectionState -eq "Maintenance"}
foreach ($VMhost in $VMhosts) {
#region: Upload Patch
$Datastore = $VMhost | Get-Datastore -Name $TempDatastoreName
# Parameters
$ClusterName = "win"
$DatastoreName = "scratch00"
# Get Cluster
$Cluster = Get-Cluster -Name $ClusterName
# Disable VM DRS Roles
$Cluster | Get-DrsRule | Set-DrsRule -Enabled:$false