Skip to content

Commit

Permalink
gc
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaranionjc committed Jan 31, 2024
1 parent 131db86 commit 5ccffa4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions jumpcloud-ADMU/Powershell/Tests/Migration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,22 @@ Describe 'Migration Test Scenarios' {

$protocol = "http"
$fileType = ".txt"
New-Item -Path "HKEY_USERS:\$($initUserSid)\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$($fileType)\UserChoice" -Force
$result = New-Item -Path "HKEY_USERS:\$($initUserSid)\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$($fileType)\UserChoice" -Force
# Garbage collection to ensure the registry is updated
$result.Handle.Close()
[gc]::collect()
[gc]::WaitForPendingFinalizers()

Set-FTA "C:\Program Files\Windows NT\Accessories\wordpad.exe" $fileType

New-Item -Path "HKEY_USERS:\$($initUserSid)\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\$($protocol)\UserChoice" -Force
$result = New-Item -Path "HKEY_USERS:\$($initUserSid)\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\$($protocol)\UserChoice" -Force
[gc]::Collect()
[gc]::WaitForPendingFinalizers()

Set-PTA -Protocol $protocol -ProgId "notepad"

[gc]::collect()
Start-Sleep -Seconds 10
[gc]::WaitForPendingFinalizers()
REG UNLOAD "HKU\$($initUserSid)" *>&1
if ($?) {
Write-ToLog -Message:('Unloaded Profile: ' + "NTUSER.DAT.BAK")
Expand Down

0 comments on commit 5ccffa4

Please sign in to comment.