Skip to content

Instantly share code, notes, and snippets.

View vMarkusK's full-sized avatar

Markus Kraus vMarkusK

View GitHub Profile
@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
@vMarkusK
vMarkusK / StoreOnce-Report.ps1
Last active June 4, 2019 22:29
Reports StoreOnce Catalyst Stores via RESTapi
# Workaround for SelfSigned Cert
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
@vMarkusK
vMarkusK / StoreOnce-Report.js
Created April 12, 2016 14:27
Reports StoreOnce Catalyst Stores
var SIDs_Request = RH_XXXXD2D.createRequest("GET", '/storeonceservices/cluster/servicesets/' , null);
SIDs_Request.setHeader('Accept', 'text/xml');
var SIDs_Response = SIDs_Request.execute();
var SIDs_XML = XMLManager.fromString(SIDs_Response.contentAsString);
var SIDs_Elements = SIDs_XML.getElementsByTagName("serviceset");
var SIDs_Count = SIDs_Elements.length;
System.log ("Number of SIDs:" + SIDs_Count + " on " + RH_XXXXD2D.name);
var Stores_Count = 0;
for (var i = 1; i <= SIDs_Count; i++) {
@vMarkusK
vMarkusK / myMove-VM.ps1
Last active April 20, 2016 08:13
Moves a VM betwenn vSphere Datacenters. Changes Host, Datastore and Cluster.
<#
.SYNOPSIS
Moves a VM betwenn vSphere Datacenters
.DESCRIPTION
Changes Host, Datastore and Cluster.
.EXAMPLE
myMove-VM.ps1 -VMname "yourVM" -newCluster "yourCluster" -NewDS "yourDS*" -VIServer "yourvCenter.lan.local"
$DAPs = @("DAP01.lan.local","DAP02.lan.local") #MediaSever
$DPCs = @("DPC01.lan.local") #Cell Server
$TempPath = "D:\OmniBackData\tmp" #Path to DP Temp Files
foreach ($DAP in $DAPs) {
Write-Output "Testing $DAP..."
if (Test-WsMan $DAP) {
Write-Output "Processing $DAP..."
Invoke-Command -ComputerName $DAP -ScriptBlock {Get-Service -Name omniInet | Stop-Service}
Invoke-Command -ComputerName $DAP -ScriptBlock {Get-ChildItem $TempPath | Remove-Item -Confirm:$False -Recurse}
@vMarkusK
vMarkusK / ubuntu16-customization.sh
Created May 2, 2016 14:58
ubuntu 16.04 Guest Customization Shell Script
#!/bin/bash
HOSTNAME=$1
IP=$2
SUBNET=$3
GATEWAY=$4
DOMAIN=$5
SEARCH=$6
DNS1=$7
DNS2=$8
@vMarkusK
vMarkusK / Push-vLIMessage.ps1
Last active November 3, 2016 12:29
Push Messages to VMware vRealize Log Inisght
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
@vMarkusK
vMarkusK / Create-PSModuleStructure.ps1
Created June 1, 2016 12:30
Creates a Structure for a PS Module for PowerShell Gallery
$GitPath = 'C:\Users\mkraus\Documents\GitHub\PowerShell-Gallery-Test'
$ModuleName = 'PSGallery-Test'
$Author = 'Markus Kraus'
$Description = 'PSGallery-Test is a Test'
$CompanyName = 'mycloudrevolution'
$Copyright = '(c) 2016 Markus Kraus. All rights reserved.'
$ProjectUri = 'https://github.com/mycloudrevolution/PowerShell-Gallery-Test/'
$LicenseUri = $ProjectUri + 'LICENSE'
$Tags = 'mycloudrevolution','test'
@vMarkusK
vMarkusK / Publish-PSModule.ps1
Created June 1, 2016 13:04
Publishes a PowerShell Module to PowerShell Gallery
$Path = 'C:\Users\mkraus\Documents\GitHub\PowerShell-Gallery-Test\PSGallery-Test'
$PublishParams = @{
NuGetApiKey = 'your-API-key' # Swap this out with your API key
Path = $Path
}
Publish-Module @PublishParams
Find-Module PSGallery-Test
@vMarkusK
vMarkusK / PSGallery-Test.Tests.ps1
Last active June 1, 2016 13:47
Basic Pesser Test
Describe 'Module Test' {
It 'Tests the Output of my Module' {
Install-Module -Name PSGallery-Test -Force; Import-Module -Name PSGallery-Test; Get-Awsome | Should Be 'Get Awsome, Learn PowerShell! (http://mycloudrevolution.com/)'
}
}