|
6 | 6 | .DESCRIPTION |
7 | 7 | • Chooses an exFAT cluster size (auto or explicit). |
8 | 8 | • Calculates the minimum container size using an iterative approach for FAT/Bitmap sizing, plus safety margin. |
9 | | - • Creates, mounts, copies, verifies, and dismounts – all guarded by -WhatIf/-Confirm (SupportsShouldProcess). |
| 9 | + • Creates, mounts, copies, verifies, and unmounts – all guarded by -WhatIf/-Confirm (SupportsShouldProcess). |
10 | 10 | • Finds VeraCrypt automatically or takes a -VeraCryptDir override. |
11 | 11 | • Encryption and hash algorithms are parameters. |
12 | 12 | • Password can be passed via SecureString prompt or pipeline. |
@@ -420,13 +420,13 @@ try { |
420 | 420 | } finally { |
421 | 421 | if (Test-Path variable:plainPassword) { Clear-Variable plainPassword -ErrorAction SilentlyContinue } |
422 | 422 | if ($mounted) { |
423 | | - if ($PSCmdlet.ShouldProcess("Drive $driveLetter", "Dismount VeraCrypt volume")) { |
424 | | - Write-Verbose "Dismounting drive $driveLetter..." |
425 | | - $dismountArgs = @('/dismount', $driveLetter, '/force', '/quit', '/silent') |
426 | | - Start-Process -FilePath $VeraCryptExe -ArgumentList $dismountArgs -NoNewWindow -Wait -ErrorAction SilentlyContinue |
427 | | - Write-Verbose "Dismount command issued." |
| 423 | + if ($PSCmdlet.ShouldProcess("Drive $driveLetter", "Unmount VeraCrypt volume")) { |
| 424 | + Write-Verbose "Unmounting drive $driveLetter..." |
| 425 | + $unmountArgs = @('/unmount', $driveLetter, '/force', '/quit', '/silent') |
| 426 | + Start-Process -FilePath $VeraCryptExe -ArgumentList $unmountArgs -NoNewWindow -Wait -ErrorAction SilentlyContinue |
| 427 | + Write-Verbose "Unmount command issued." |
428 | 428 | } else { |
429 | | - Write-Host "Dismount skipped due to -WhatIf." |
| 429 | + Write-Host "Unmount skipped due to -WhatIf." |
430 | 430 | } |
431 | 431 | } |
432 | 432 | foreach($f in @($errFile,$mountFile) | Where-Object { $_ }) { |
|
0 commit comments