diff --git a/src/playbook/Executables/ASSOC.ps1 b/src/playbook/Executables/ASSOC.ps1 index dcdf641c74..7086a33c84 100644 --- a/src/playbook/Executables/ASSOC.ps1 +++ b/src/playbook/Executables/ASSOC.ps1 @@ -201,9 +201,12 @@ if ($Hive.StartsWith("S-")) $fileStream.Close() $dataString = [Text.Encoding]::Unicode.GetString($bytesData) $position1 = $dataString.IndexOf($userExperienceSearch) - $position2 = $dataString.IndexOf("}", $position1) - - $userExperience = $dataString.Substring($position1, $position2 - $position1 + 1) + if ($position1 -ge 0) { + $position2 = $dataString.IndexOf("}", $position1) + if ($position2 -gt $position1) { + $userExperience = $dataString.Substring($position1, $position2 - $position1 + 1) + } + } } Write-Host "Setting file associations for HKEY_USERS\$Hive..." diff --git a/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 b/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 index 194926511d..ea689993eb 100644 --- a/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 +++ b/src/playbook/Executables/AtlasModules/Scripts/ScriptWrappers/EnableFileSharing.ps1 @@ -11,7 +11,7 @@ Start-Process -FilePath "$networkDiscoveryConfigPath\Enable Network Discovery Se # Enable NetBios over TCP/IP $interfaces = Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces" -Recurse | Where-Object { $_.GetValue("NetbiosOptions") -ne $null } foreach ($interface in $interfaces) { - Set-ItemProperty -Path $interface.PSPath -Name "NetbiosOptions" -Value 2 | Out-Null + Set-ItemProperty -Path $interface.PSPath -Name "NetbiosOptions" -Value 0 | Out-Null } # Enable NetBIOS service diff --git a/src/playbook/Executables/AtlasModules/Scripts/packageInstall.ps1 b/src/playbook/Executables/AtlasModules/Scripts/packageInstall.ps1 index 1f4a9ef447..cbc1630b0c 100644 --- a/src/playbook/Executables/AtlasModules/Scripts/packageInstall.ps1 +++ b/src/playbook/Executables/AtlasModules/Scripts/packageInstall.ps1 @@ -303,7 +303,7 @@ function ProcessCab($cabPath) { return $false } - # add test cert + # add Atlas cert to root store # isn't cleared later as it's required for the alt repair source $certRegPath = "HKLM:\Software\Microsoft\SystemCertificates\ROOT\Certificates\8A334AA8052DD244A647306A76B8178FA215F344" if (!(Test-Path "$certRegPath")) { diff --git a/src/playbook/Executables/CLEANUP.ps1 b/src/playbook/Executables/CLEANUP.ps1 index 1cec2ad6d4..bd2582a689 100644 --- a/src/playbook/Executables/CLEANUP.ps1 +++ b/src/playbook/Executables/CLEANUP.ps1 @@ -101,4 +101,4 @@ else { # Delete all system restore points # This is so that users can't attempt to revert from Atlas to stock with Restore Points # It won't work, a full Windows reinstall is required ^ -vssadmin delete shadows /all /quiet +vssadmin delete shadows /all /quiet 2>$null diff --git a/src/playbook/Executables/LIBREWOLF.ps1 b/src/playbook/Executables/LIBREWOLF.ps1 index 0e46739b99..286e3e65eb 100644 --- a/src/playbook/Executables/LIBREWOLF.ps1 +++ b/src/playbook/Executables/LIBREWOLF.ps1 @@ -23,6 +23,7 @@ $librewolfDownload = "https://gitlab.com/api/v4/projects/$gitLabId/packages/gene Write-Output "Downloading the latest LibreWolf setup" $outputLibrewolf = "$drive\$librewolfFileName" curl.exe -LSs "$librewolfDownload" -o "$outputLibrewolf" $timeouts +if (!$?) { throw "Downloading LibreWolf failed." } Write-Output "Installing LibreWolf silently" Start-Process -Wait -FilePath $outputLibrewolf -ArgumentList "/S" @@ -44,6 +45,7 @@ $librewolfUpdaterDownload = (Invoke-RestMethod -Uri "$librewolfUpdaterURI").Asse Write-Output "Downloading the latest LibreWolf WinUpdater ZIP" $outputLibrewolfUpdater = "$drive\librewolf-winupdater.zip" curl.exe -LSs "$librewolfUpdaterDownload" -o "$outputLibrewolfUpdater" $timeouts +if (!$?) { throw "Downloading LibreWolf WinUpdater failed." } Write-Output "Extracting Librewolf-WinUpdater" Expand-Archive -Path $outputLibrewolfUpdater -DestinationPath "$programs\LibreWolf\librewolf-winupdater" -Force diff --git a/src/playbook/Executables/SETPATHS.ps1 b/src/playbook/Executables/SETPATHS.ps1 index 6f9406b054..853527e50d 100644 --- a/src/playbook/Executables/SETPATHS.ps1 +++ b/src/playbook/Executables/SETPATHS.ps1 @@ -16,7 +16,9 @@ foreach ($key in $registryKeys) { if ($path -notlike "$windir\AtlasDesktop\*") { $marker = "AtlasDesktop\" $index = $path.IndexOf($marker) - $result = $path.Substring($index + $marker.Length) - Set-ItemProperty -Path $key.PSPath -Name $valueName -Value "$windir\AtlasDesktop\$result" + if ($index -ge 0) { + $result = $path.Substring($index + $marker.Length) + Set-ItemProperty -Path $key.PSPath -Name $valueName -Value "$windir\AtlasDesktop\$result" + } } } diff --git a/src/playbook/Executables/TASKBARPINS.ps1 b/src/playbook/Executables/TASKBARPINS.ps1 index b34baab00e..5d4841efe7 100644 --- a/src/playbook/Executables/TASKBARPINS.ps1 +++ b/src/playbook/Executables/TASKBARPINS.ps1 @@ -96,11 +96,9 @@ foreach ($userKey in (Get-RegUserPaths -NoDefault).PsPath) { Write-Output "Clearing current shortcuts..." $taskBarAppData = "$appData\$taskBarLocation" - if (Test-Path $taskBarAppData -PathType Leaf) { - Write-Output "Deleting TaskBar file..." - Remove-Item -Path $taskBarAppData -Force + if (Test-Path $taskBarAppData) { + Remove-Item -Path "$taskBarAppData\*" -Force -Recurse } - Get-ChildItem $taskBarAppData | Remove-Item -Force -Recurse Write-Output "Adding new shortcuts..." Copy-Item -Path "$tmp\*" -Destination $taskBarAppData -Force