Day: March 11, 2020

PowerShell: File Server Cluster Migration Scripts

<# File-Server-Migration-Intra-Domain.ps1 Purposes: 1. Create Volumes with Labels 2. Create Virtual Clustered File Servers 3.…

PowerShell: Quick EMCopy

# Short Version $arr=@(); $arr+=[PSCustomObject]@{From='D:\Someshare';To='\\NEWSERVER\Someshare'} $arr+=[PSCustomObject]@{From='D:\Test';To='\\NEWSERVER\Test'} # Normal copying # $arr|%{emcopy $_.From $_.To /s /de…

PowerShell: Copying File Share Permissions from Source to Destination

# Copy-SMB-Share-Permissions.ps1 # Set some SMB Share variables $sourceSmbPath="\\FILESERVER002\Home" $destinationSmbPath="\\FILESERVER002-n\Home" $dateStamp = Get-Date -Format "yyyy-MM-dd-hhmmss"…

PowerShell: Expand Volume of Virtual FileServer Role

Option 1: Expanding disk of a Virtual Machine in Hyper-V # ExpandVolumeVirtualFileServerRole.ps1 # Update these…

PowerShell: ADFS Backup and Restore

# AD FS Backup and Restore # Reference documentation: https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/operations/ad-fs-rapid-restore-tool # Set Variables $filePassword="password" $adfsToolDownload="https://download.microsoft.com/download/6/8/A/68AF3CD3-1337-4389-967C-A6751182F286/ADFSRapidRecreationTool.msi"…

PowerShell: Moving Guest VMs in Hyper-V in Conjunction with Microsoft Failover Cluster

This code is outdated. Refactor before reuse.. ############################################################################################################### # HyperV-MoveVM.ps1 # Assumption: Hyper-V has been…

PowerShell: Create Mailbox Report on Office 365

# connect-to-exchange-online.ps1 # How to connect to Office 365 Cloud Services using PowerShell # Office…

PowerShell: Get Active Directory Domain Controller Replication Status

$domaincontroller=(Get-ADForest |Select-Object -ExpandProperty RootDomain |Get-ADDomain |Select-Object -Property PDCEmulator).PDCEmulator; ## Define Objects ## $report = New-Object…

PowerShell: Compressing Files and Folders

# Set variables $compressTarget="C:\Temp\Win2016_Std_Template.ova" $parentFolder=split-path $compressTarget -Parent $grandParentFolder=split-path $parentFolder -Parent $compressedFile=$grandParentFolder+"\compressed.zip" # PowerShell version 5…

PowerShell: Performing System Disk Cleanup

Version 2: # cleanupWindows.ps1 # Version 0.0.2 ################################## Excuting Program as an Administrator #################################### #…

PowerShell: List Biggest Files and Folders on a Volume

# listBigFilesAndFolders-v0.01.ps1 # Set variables $parentDirectory="C:\" $depth=4 $topX=10 $excludeDirectories="C:\Windows","C:\Program Files","C:\Program Files (x86)" $clusterSizeOfNetworkShare=8192 # Sanitize…