Skip to content

Instantly share code, notes, and snippets.

@piotrkochan
piotrkochan / shred.ps
Created March 9, 2023 18:48
start virtualbox hdd shred image with hdd selector
$vm_name = "shred"
$iso_path = "C:\...\shredos-2021.08.2_23_x86-64_0.34_20221231.iso"
$directory = "C:\...\VirtualBox VMs\shred\vmdks"
# Stop the virtual machine if it's running
if ((VBoxManage.exe showvminfo $vm_name | Select-String 'State' | Select-String 'running') -ne $null) {
VBoxManage.exe controlvm $vm_name poweroff -forc
}
# Remove all existing VMDK files from the directory