Skip to content

Instantly share code, notes, and snippets.

import requests
import base64
import re
import xml.etree.ElementTree as ElementTree
import xml.etree.ElementTree as ET
from datetime import datetime, timedelta
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import pandas as pd
# Disable SSL certificate validation warning
@mritsurgeon
mritsurgeon / GFS-expiry.ps1
Created July 8, 2021 17:25
Get GFS expiry by day based Retention ( Veeam)
Add-PsSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
#Connect-VBRServer -Server localhost
#Use backup Older than X Days
$olderthandays = 3
#GFS Set Your retention
$Monthly = 6
@mritsurgeon
mritsurgeon / Checkclone.ps1
Last active May 4, 2023 08:27
Check Fast clone Health with Veeam
$verbose=$False;if ($args[0] -eq "-verbose" -or $args[0] -eq "--v") {$verbose=$True;write-output ""}
$info="Started "+(date)
write-output $info
$logpath="C:\ProgramData\Veeam\Backup"
$disp="Check for fastclone in backup logs for server "+(hostname)
write-output $disp
$jobs=(Get-VBRJob | ?{$_.jobtype -eq "Backup"})
$data=@();
foreach ($j in ($jobs)) {
@mritsurgeon
mritsurgeon / ListBackupFiles.ps1
Last active June 17, 2021 08:01
Find Orphaned Backups
try{$path=($args -match "-path=").substring(6)}
catch{Write-host "missing path argument" -fore red}
try{$myhost=($args -match "-host=").substring(6)}
catch{Write-host "missing host argument" -fore red}
if (!$path.contains('\')) {
Write-host "suspiscious path provided $path. please use quotes for arguments." -fore red
exit
}
$unc="\\$myhost\"+$path.replace(':','$')
try {gci $unc -erroraction stop > $null}
@mritsurgeon
mritsurgeon / Get-PII2.ps1
Last active April 6, 2023 19:55
Get-PII (Protection of Personal Identifiable Information)
function Log {
<#
.Synopsis
Function to log input string to file and display it to screen
.Description
Function to log input string to file and display it to screen. Log entries in the log file are time stamped. Function allows for displaying text to screen in different colors.
.Parameter String
The string to be displayed to the screen and saved to the log file
@mritsurgeon
mritsurgeon / Replicate_to_azure_veeam.ps1
Created August 13, 2020 08:41
Script to replicate to azure using Veeam VBR & Veeam VBA
# Auth Get Token
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer")
$headers.Add("Content-Type", "application/x-www-form-urlencoded")
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
@mritsurgeon
mritsurgeon / VeeamPubVletter.ps1
Created June 30, 2020 08:23
Veeam Publish with Drive letter assignment
# Add veeam snapin
Add-PSSnapin VeeamPSSnapin
# Connect to veeam backup server
Connect-VBRServer -Server "veeam" -User "Usernamer" -Password "****"
# Assign veriables to each restore point being used & Credntials for mount process
@mritsurgeon
mritsurgeon / FRSA.ps1
Created February 9, 2020 07:31
Full Restore Script Azure
Add-PSSnapin VeeamPSSnapin
Connect-VBRServer -Server "YOUR BACKUP SERVER"
$restorepointNC = Get-VBRBackup -Name "Azurestack Infrastructure" | Get-VBRRestorePoint -Name "AzS-NC01" | Sort-Object $_.creationtime -Descending | Select -First 1
$restorepointACS = Get-VBRBackup -Name "Azurestack Infrastructure" | Get-VBRRestorePoint -Name "AzS-ACS01" | Sort-Object $_.creationtime -Descending | Select -First 1
$restorepointWAS = Get-VBRBackup -Name "Azurestack Infrastructure" | Get-VBRRestorePoint -Name "AzS-WAS01" | Sort-Object $_.creationtime -Descending | Select -First 1
$restorepointWASP = Get-VBRBackup -Name "Azurestack Infrastructure" | Get-VBRRestorePoint -Name "AzS-WASP01" | Sort-Object $_.creationtime -Descending | Select -First 1
$restorepointSRN = Get-VBRBackup -Name "Azurestack Infrastructure" | Get-VBRRestorePoint -Name "AzS-SRNG01" | Sort-Object $_.creationtime -Descending | Select -First 1
$restorepointGW = Get-VBRBackup -Name "Azurestack Infrastructure" | Get-VBRRestorePoint -Name "AzS-Gwy01" | Sort-
@mritsurgeon
mritsurgeon / Direct Restore Azure
Created February 8, 2020 19:29
Direct-restore Azure
Start-VBRVMRestoreToAzure -RestorePoint $restorepointNC -Subscription $subscription -StorageAccount $storageaccount -VmSize $vmsizeSMALL -VirtualNetwork $network -VirtualSubnet $subnet -ResourceGroup $resourcegroup -VmName Azs-NC01-Azure -Reason "TESTING MY NEW SCRIPT"
Start-VBRVMRestoreToAzure -RestorePoint $restorepointACS -Subscription $subscription -StorageAccount $storageaccount -VmSize $vmsizeSMALL -VirtualNetwork $network -VirtualSubnet $subnet -ResourceGroup $resourcegroup -VmName Azs-ACS01-Azure -Reason "TESTING MY NEW SCRIPT"
Start-VBRVMRestoreToAzure -RestorePoint $restorepointWAS -Subscription $subscription -StorageAccount $storageaccount -VmSize $vmsizeMEDIUM -VirtualNetwork $network -VirtualSubnet $subnet -ResourceGroup $resourcegroup -VmName Azs-WAS01-Azure -Reason "TESTING MY NEW SCRIPT"
Start-VBRVMRestoreToAzure -RestorePoint $restorepointWASP -Subscription $subscription -StorageAccount $storageaccount -VmSize $vmsizeMEDIUM -VirtualNetwork $network -VirtualSubnet $subnet -ResourceGroup $resou
@mritsurgeon
mritsurgeon / VMSize-restore.ps1
Created February 8, 2020 19:22
VM-Sizes azure
$vmsizeSMALL = Get-VBRAzureVMSize -Subscription $subscription -Location $location -Name Standard_A2_v2
$vmsizeMEDIUM = Get-VBRAzureVMSize -Subscription $subscription -Location $location -Name Standard_A4_v2
$vmsizeLARGE = Get-VBRAzureVMSize -Subscription $subscription -Location $location -Name Standard_A8_v2