|
227 | 227 | $null = Dismount-VHD -Path $item.CloneLocation -Credential $Credential |
228 | 228 | } |
229 | 229 | else { |
230 | | - $command = [ScriptBlock]::Create("Test-Path -Path $($item.CloneLocation)") |
231 | | - Write-PSFMessage -Message "Dismounting disk $($item.CloneLocation) from $($item.HostName)" -Level Verbose |
| 230 | + $command = [ScriptBlock]::Create("Test-Path -Path '$($item.CloneLocation)'") |
| 231 | + Write-PSFMessage -Message "Dismounting disk '$($item.CloneLocation)' from $($item.HostName)" -Level Verbose |
232 | 232 | $result = Invoke-PSFCommand -ComputerName $item.HostName -ScriptBlock $command -Credential $Credential |
233 | 233 | #if (-not $result) { |
234 | | - $command = [scriptblock]::Create("Dismount-VHD -Path `"$($item.CloneLocation)`"") |
| 234 | + $command = [scriptblock]::Create("Dismount-VHD -Path '$($item.CloneLocation)'") |
235 | 235 | $null = Invoke-PSFCommand -ComputerName $item.HostName -ScriptBlock $command -Credential $Credential |
236 | 236 | #} |
237 | 237 | } |
|
246 | 246 | try { |
247 | 247 | if ($computer.IsLocalhost) { |
248 | 248 | Write-PSFMessage -Message "Removing vhd access path" -Level Verbose |
249 | | - $null = Remove-Item -Path $item.AccessPath -Credential $Credential -Force |
| 249 | + $null = Remove-Item -Path "$($item.AccessPath)" -Credential $Credential -Force |
250 | 250 |
|
251 | 251 | Write-PSFMessage -Message "Removing vhd" -Level Verbose |
252 | | - $null = Remove-Item -Path $item.CloneLocation -Credential $Credential -Force |
| 252 | + $null = Remove-Item -Path "$($item.CloneLocation)" -Credential $Credential -Force |
253 | 253 | } |
254 | 254 | else { |
255 | 255 | Write-PSFMessage -Message "Removing vhd access path" -Level Verbose |
256 | | - $command = [scriptblock]::Create("Remove-Item -Path $($item.AccessPath) -Force") |
| 256 | + $command = [scriptblock]::Create("Remove-Item -Path '$($item.AccessPath)' -Force") |
257 | 257 | $null = Invoke-PSFCommand -ComputerName $item.HostName -ScriptBlock $command -Credential $Credential |
258 | 258 |
|
259 | 259 | Write-PSFMessage -Message "Removing vhd" -Level Verbose |
260 | | - $command = [scriptblock]::Create("Remove-Item -Path $($item.CloneLocation) -Force") |
| 260 | + $command = [scriptblock]::Create("Remove-Item -Path '$($item.CloneLocation)' -Force") |
261 | 261 | $null = Invoke-PSFCommand -ComputerName $item.HostName -ScriptBlock $command -Credential $Credential |
262 | 262 | } |
263 | 263 | } |
|
287 | 287 | $newCloneData = $cloneData | Where-Object {$_.CloneID -ne $item.CloneID} |
288 | 288 |
|
289 | 289 | # Set the clone file |
290 | | - $jsonCloneFile = "JSONFolder:\clones.json" |
| 290 | + $jsonCloneFile = "PSDCJSONFolder:\clones.json" |
291 | 291 |
|
292 | 292 | # Convert the data back to JSON |
293 | 293 | if($newCloneData.Count -ge 1){ |
|
0 commit comments