-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix with oscdimg.exe search, ExecutionPolicy, compression, etc.. #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
49dac34
b0750f3
e1273fe
f1e79e8
e9d131c
5fae99b
688458d
df16ad6
a5864da
1c8480a
e094eff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| :: Reference from https://github.com/Raphire/Win11Debloat/blob/master/Run.bat licensed under MIT license. | ||
|
|
||
| @echo off | ||
|
|
||
| Powershell -ExecutionPolicy Bypass -Command "& {Start-Process Powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dp0tiny11maker.ps1""' -Verb RunAs}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| # Enable debugging | ||
| Set-PSDebug -Trace 1 | ||
|
|
||
| # Check if PowerShell execution is restricted | ||
| if ((Get-ExecutionPolicy) -eq 'Restricted') { | ||
| Write-Host "Your current PowerShell Execution Policy is set to Restricted, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)" | ||
| # Check if PowerShell execution is Restricted or AllSigned or Undefined | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am curious if this part is actually called, is this for some possible cases where the user tries to run it from powershell they have been using for different activity which could have set ExecutionPolicy to the value that does not allow script to run? I think in normal cases, the user will run it with from the powershell which have the ExecutionPolicy that allow to run custom scripts, and it is inherited, which make it will never be the ones that need to be changed for elevation. |
||
| $needchange = @("AllSigned", "Restricted", "Undefined") | ||
| $curpolicy = Get-ExecutionPolicy | ||
| if ($curpolicy -in $needchange) { | ||
| Write-Host "Your current PowerShell Execution Policy is set to $curpolicy, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)" | ||
| $response = Read-Host | ||
| if ($response -eq 'yes') { | ||
| Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm:$false | ||
| Set-ExecutionPolicy RemoteSigned -Scope Process -Confirm:$false | ||
| } else { | ||
| Write-Host "The script cannot be run without changing the execution policy. Exiting..." | ||
| exit | ||
|
|
@@ -730,16 +732,25 @@ Write-Host "Exporting ESD. This may take a while..." | |
| Remove-Item "$mainOSDrive\tiny11\sources\install.wim" > $null 2>&1 | ||
| Write-Host "The tiny11 image is now completed. Proceeding with the making of the ISO..." | ||
| Write-Host "Creating ISO image..." | ||
| $ADKDepTools = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg" | ||
| # Get Windows ADK path from registry(following Visual Studio's winsdk.bat approach). | ||
| $WinSDKPath = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots", "KitsRoot10", $null) | ||
| if ($null -eq $WinSDKPath) { | ||
| $WinSDKPath = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots", "KitsRoot10", $null) | ||
| } | ||
|
|
||
| if ($null -ne $WinSDKPath) { | ||
| # Trim the following backslash for path concatenation. | ||
| $WinSDKPath = $WinSDKPath.TrimEnd('\') | ||
| $ADKDepTools = "$WinSDKPath\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg" | ||
| } | ||
| $localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe" | ||
|
|
||
| if ([System.IO.Directory]::Exists($ADKDepTools)) { | ||
| if ((Test-Path variable:ADKDepTools) -and (Test-Path "$ADKDepTools\oscdimg.exe" -PathType leaf)) { | ||
| Write-Host "Will be using oscdimg.exe from system ADK." | ||
| $OSCDIMG = "$ADKDepTools\oscdimg.exe" | ||
| } else { | ||
| Write-Host "ADK folder not found. Will be using bundled oscdimg.exe." | ||
|
|
||
|
|
||
| Write-Host "oscdimg.exe from system ADK not found. Will be using bundled oscdimg.exe." | ||
|
|
||
| $url = "https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe" | ||
|
|
||
| if (-not (Test-Path -Path $localOSCDIMGPath)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍