Skip to content

Instantly share code, notes, and snippets.

@mritsurgeon
mritsurgeon / Get-PII2.ps1
Last active Mar 8, 2021
Get-PII (Protection of Personal Identifiable Information)
View Get-PII2.ps1
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 Aug 13, 2020
Script to replicate to azure using Veeam VBR & Veeam VBA
View Replicate_to_azure_veeam.ps1
# 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 Jun 30, 2020
Veeam Publish with Drive letter assignment
View VeeamPubVletter.ps1
# 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 Feb 9, 2020
Full Restore Script Azure
View FRSA.ps1
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-
View 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
View VMSize-restore.ps1
$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
@mritsurgeon
mritsurgeon / Azuresettings.ps1
Created Feb 8, 2020
Azure VAriable for restore
View Azuresettings.ps1
$accountCloud = Get-VBRAzureAccount -Type ResourceManager -Name "yournamet@yourdomain.com"
$subscription = Get-VBRAzureSubscription -Account $accountCloud -Name "your subscription"
$storageaccount = Get-VBRAzureStorageAccount -Subscription $subscription -Name "southafrica01"
$location = Get-VBRAzureLocation -Subscription $subscription -Name "southafricanorth"
$network = Get-VBRAzureVirtualNetwork -Subscription $subscription -Name "SouthAfrica-Vlan"
$subnet = Get-VBRAzureVirtualNetworkSubnet -Network $network -Name "default"
$resourcegroup = Get-VBRAzureResourceGroup -Subscription $subscription -Name "SouthAfrica-Demo"
@mritsurgeon
mritsurgeon / VBR-DATA-Variable.ps1
Created Feb 8, 2020
Azure Backup data Variables
View VBR-DATA-Variable.ps1
$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-Object $_.creationtime -Descending | Select -First 1
$restorepointSQL = Get
@mritsurgeon
mritsurgeon / Connect to VBR.ps1
Created Feb 8, 2020
Connecting to veeam backup server on PS
View Connect to VBR.ps1
Add-PSSnapin VeeamPSSnapin
Connect-VBRServer -Server "veeam"
@mritsurgeon
mritsurgeon / OneNodeRole.xml
Created Jan 8, 2020
OneNodeRole for Fabric ASDK Nested
View OneNodeRole.xml
<?xml version="1.0" encoding="UTF-8"?>
-<Role PSClass="Classes\VirtualMachines\VirtualMachines.psm1" Type="Resource" Id="VirtualMachines">
-<PublicInfo>
-<Logs Enabled="True">