aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/windows/helpers.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'coin/provisioning/common/windows/helpers.ps1')
-rw-r--r--coin/provisioning/common/windows/helpers.ps119
1 files changed, 19 insertions, 0 deletions
diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1
index 9cd8567e..5a7eb674 100644
--- a/coin/provisioning/common/windows/helpers.ps1
+++ b/coin/provisioning/common/windows/helpers.ps1
@@ -191,3 +191,22 @@ function Retry{
Throw("Failed to run command successfully in $retry_count tries")
}
}
+
+function Remove {
+
+ Param (
+ [string]$Path = $(BadParam("a path"))
+ )
+ Write-Host "Removing $Path"
+ $i = 0
+ While ( Test-Path($Path) ){
+ Try{
+ remove-item -Force -Recurse -Path $Path -ErrorAction Stop
+ }catch{
+ $i +=1
+ if ($i -eq 5) {exit 1}
+ Write-Verbose "$Path locked, trying again in 5"
+ Start-Sleep -seconds 5
+ }
+ }
+}