Skip to content

Instantly share code, notes, and snippets.

Markus Kraus mycloudrevolution

Block or report user

Report or block mycloudrevolution

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mycloudrevolution
mycloudrevolution / Get-VamiHeatlth.ps1
Created Apr 11, 2019
vCenter VAMI Health for Influx API
View Get-VamiHeatlth.ps1
# External References
## https://github.com/rumart/vSpherePerfData/blob/master/vcsa/appliance_health.ps1
# Config
$vCenter = "<vCenter FQDN>"
$Metrics = "applmgmt","database-storage","load","mem","software-packages","storage","swap","system"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Create Credentials
#$Credentials = Get-Credential -Message "Vami Crendetials"
@mycloudrevolution
mycloudrevolution / VeeamvCloudAutoCreateJob.ps1
Last active Aug 11, 2019
Veeam vCloud Auto Create Job
View VeeamvCloudAutoCreateJob.ps1
Param (
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Veeam BR Credentials")]
[ValidateNotNullorEmpty()]
[PSCredential]$VeeamCred,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Veeam BR Server")]
[ValidateNotNullorEmpty()]
[String]$VeeamVBRServer,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Veeam Backup Job Scale-Out Repository Name")]
[ValidateNotNullorEmpty()]
[ValidateSet("SOR_03","SOR_06")]
View EsxiHostConfig.ps1
function Set-MyESXiOption {
[CmdletBinding()]
param(
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
[String] $Name,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=1)]
[String] $Value
)
process {
$myESXiOption = Get-AdvancedSetting -Entity $VMhost -Name $Name
@mycloudrevolution
mycloudrevolution / EsxiHostHardening.ps1
Created Jan 15, 2019
VMware ESXi Host Base Hardening
View EsxiHostHardening.ps1
foreach ($VMhost in (Get-VMHost))
{
#Stop SSH Service
$ServiceList = Get-VMHostService -VMhost $VMhost
$SSHservice = $ServiceList | Where-Object {$_.Key -eq "TSM-SSH"}
If ($SSHservice.Running -eq $true) {Stop-VMHostService -HostService $SSHService -Confirm:$false}
else {Write-Output "SSH Server on host $VMhost is Stopped"}
$Shellservice = $ServiceList | Where-Object {$_.Key -eq "TSM"}
If ($Shellservice.Running -eq $true) {Stop-VMHostService -HostService $Shellservice -Confirm:$false}
else {Write-Output "Shell Server on host $VMhost is Stopped"}
View PowerShell Password Complexity Requirements.ps1
$Credential = Get-Credential
$Password = $Credential.GetNetworkCredential().Password
if(($Password -cmatch '[a-z]') -and ($Password -cmatch '[A-Z]') -and ($Password -match '\d') -and ($Password.length -ge 12) -and $Password -match '!|@|#|%|^|&|$|_') {
Remove-Variable Password
Write-Output "Password is valid"
}
else {
Remove-Variable Password
$Valid = $false
Throw "Invalid Password!
@mycloudrevolution
mycloudrevolution / Backup-VCSAToFile.ps1
Created Nov 5, 2018
Create a VCSA Backup via BackupAPI. Used as a Veeam Pre or Post Script
View Backup-VCSAToFile.ps1
Start-Transcript -Path "C:\Scripts\Logs\Backup-$((Get-Date).ToString('yyyy-MM-dd-hh-mm')).log"
#region: Log Rotate
$LogPath = "C:\Scripts\Logs\*"
$LogFiles = "*.log"
[int] $LogRetention = "-14" # in Days
Get-ChildItem $LogPath -Include $LogFiles -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays($LogRetention)} | Remove-Item
#endregion
#region: Import Module
View Find Duplicate VM IPs.ps1
Function GetArrayDupes {
param($array)
$hash = @{}
$array | %{ $hash[$_] = $hash[$_] + 1 }
$result = $hash.GetEnumerator() | ?{$_.value -gt 1} | %{$_.key}
Return $result
}
$VMs = Get-VM
$IPs = $VMs.Guest.IPAddress
View Update Get-CIDatastore Threshold.ps1
$CiDs = Get-CIDatastore | where {$_.Name -like "LOCAL-*"} | Get-CIView
foreach ($object in $CiDs ){
$Cap = $object.TotalCapacityGb
$red = [math]::round($object.TotalCapacityGb/85, 0)
$yellow = [math]::round($object.TotalCapacityGb/75, 0)
Write-Host "Total Cap: '$cap GB'"
Write-Host "New ThresholdRedGb: '$red GB'"
Write-Host "New ThresholdYellowGb: '$yellow GB'"
$object.ThresholdRedGb = $red
@mycloudrevolution
mycloudrevolution / ESXi-NetApp-Config.ps1
Created Feb 22, 2018
This Script Configures ESXi DNS, NTP, SSH, PowerProfile and NetApp Advanced Options
View ESXi-NetApp-Config.ps1
function Set-MyESXiOption {
[CmdletBinding()]
param(
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
[String] $Name,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=1)]
[String] $Value
)
process {
$myESXiOption = Get-AdvancedSetting -Entity $VMhost -Name $Name
@mycloudrevolution
mycloudrevolution / ESXi-Depot-Install-ESXCLI.ps1
Created Feb 22, 2018
This PowerCLI Script Uploads and Installs a ESXi Depot Package via ESXCLI -v2
View ESXi-Depot-Install-ESXCLI.ps1
[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
You can’t perform that action at this time.