Remove VSS Shadows on multiple windows machine on cluster


While testing our product Nimesa with Microsoft SQL Server 2016 on Microsoft Windows 2019 i hit with some scenarios my nodes in SQL cluster has some shadows, i wanted to check in all the machine and delete the shadows.

What i did is, i wrote a small powershell script which connects to all the nodes in my test bed and run diskshadow command 

delete shadows all 

For that, First i need to enable the PowerShell Remoting on all the nodes ( My nodes are connected to active directory and all are part of Windows Failover clustering )

Enable-PSRemoting -Force

And to run diskshadow commands remotely using script mode, first i write the script to temp file and delete it later

$script = “./tmp.dsh”
“list shadows all” | Set-Content $script
diskshadow /s $script
Remove-Item $script

Finally did a forloop and connected to all machines and deleted the shadows.

Note: Password is hardcoded in the script

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.