This file contains 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
<# | |
.SYNOPSIS | |
PRTG Veeam Advanced Sensor | |
.DESCRIPTION | |
Advanced Sensor will Report Statistics about Backups during last 24 Hours and Actual Repository usage. | |
.EXAMPLE | |
PRTG-VeeamBRStats.ps1 -BRHost veeam01.lan.local |
This file contains 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
function Start-ClusterPatch { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$True, ValueFromPipeline=$True, HelpMessage="vSphere Cluster to Patch")] | |
[ValidateNotNullorEmpty()] | |
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.ComputeResourceImpl] $Cluster, | |
[Parameter(Mandatory=$True, ValueFromPipeline=$false, HelpMessage="Site to Process")] | |
[ValidateNotNullorEmpty()] | |
[ValidateSet("DC1","DC2")] | |
[String] $SiteToProcess, |
This file contains 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
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")] |
This file contains 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
# 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; | |
} |
This file contains 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
# 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" |
This file contains 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
function New-VeeamTenant { | |
<# | |
.SYNOPSIS | |
Creates a vCloud Tenant Configuguration for Veeam Backuo & Replication | |
.DESCRIPTION | |
Creates a vCloud tenent Configuration for Veeam Backup & Replication. | |
The Function leverages the Veeam Ent. Manager API. The Backup Jobs need to be created seperate | |
This file contains 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
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 |
This file contains 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 ($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"} |
This file contains 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
$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! |
This file contains 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-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 |