Skip to content

Commit cdd2b8d

Browse files
Copilotntrappe-msft
andcommitted
Fix takeown redirection issue and add directory removal verification
Co-authored-by: ntrappe-msft <124631722+ntrappe-msft@users.noreply.github.com>
1 parent 6760b33 commit cdd2b8d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ Remove-DockerData()
384384
Write-Output "Taking ownership of Docker data directory..."
385385

386386
# Use Start-Process with timeout to handle hanging takeown operation
387-
$takeownProcess = Start-Process -FilePath "takeown.exe" -ArgumentList "/f", $global:DockerDataPath, "/r", "/d", "y" -WindowStyle Hidden -PassThru -RedirectStandardOutput $null -RedirectStandardError $null
387+
$takeownProcess = Start-Process -FilePath "takeown.exe" -ArgumentList "/f", $global:DockerDataPath, "/r", "/d", "y" -WindowStyle Hidden -PassThru
388388

389389
# Wait for up to 3 minutes for takeown to complete
390390
$timeoutMinutes = 3
@@ -412,7 +412,17 @@ Remove-DockerData()
412412

413413
# Now attempt to remove the directory
414414
Remove-Item $global:DockerDataPath -Recurse -Force
415-
Write-Output "Docker data directory removed."
415+
416+
# Sanity check: Verify the Docker folder no longer exists
417+
if (Test-Path $global:DockerDataPath)
418+
{
419+
Write-Warning "Docker data directory still exists after removal attempt: $global:DockerDataPath"
420+
Write-Warning "You may need to manually remove $global:DockerDataPath"
421+
}
422+
else
423+
{
424+
Write-Output "Docker data directory removed."
425+
}
416426
}
417427
catch
418428
{

0 commit comments

Comments
 (0)