-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Is your feature request related to a problem? Please describe.
I'm encountering issues where occasionally the clone files can't be created due to being locked by other processes (why is still TBD). This leaves orphaned files and no metadata entry for the clone. The next time I try to create the clone again, the function stops due to these checks:
dbaclone/functions/clone/New-DcnClone.ps1
Lines 398 to 411 in 0148b66
# Check if the clone vhd does not yet exist | |
$clonePath = [System.IO.Path]::Combine($Destination, "$($CloneName).vhdx") | |
if ($computer.IsLocalhost) { | |
if (Test-Path -Path $clonePath) { | |
Stop-PSFFunction -Message "Clone $CloneName already exists" -Target $accessPath -Continue | |
} | |
} | |
else { | |
$command = [ScriptBlock]::Create("Test-Path -Path `"$($clonePath)`"") | |
$result = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $command -Credential $Credential | |
if ($result) { | |
Stop-PSFFunction -Message "Clone $CloneName already exists" -Target $accessPath -Continue | |
} | |
} |
If using the -Force flag, it would be nice if these could be removed automatically instead of exiting, so that I don't have to write my own orphan file handling process outside of the function.
Metadata
Metadata
Assignees
Labels
No labels