Skip to main content

hyperv_leftover_script

Function hyperv_leftover_script 

Source
pub fn hyperv_leftover_script(name: &str, under: &str) -> String
Expand description

The PowerShell script that turns off and removes every Hyper-V VM named name whose disks are all under the folder under (a PowerShell expression of its path, ending in a separator so a sibling folder of the same prefix isn’t under it), and nothing if any VM of that name has a disk elsewhere (or none): it exits 0 (none), 10 (removed) or 20 (another’s, left alone), so an elevated run (whose output can’t be read) says what it did too. An uninstaller can run it for the test’s folder.