mirror of
https://github.com/ntdevlabs/tiny11builder.git
synced 2025-12-18 17:34:13 +00:00
fix: do not call method on $null object
- fix the cause of crash if ADK is not installed
This commit is contained in:
parent
b0750f317c
commit
e1273fe6ca
2 changed files with 8 additions and 4 deletions
|
|
@ -732,9 +732,11 @@ Write-Host "Exporting ESD. This may take a while..."
|
||||||
Remove-Item "$mainOSDrive\tiny11\sources\install.wim" > $null 2>&1
|
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 "The tiny11 image is now completed. Proceeding with the making of the ISO..."
|
||||||
Write-Host "Creating ISO image..."
|
Write-Host "Creating ISO image..."
|
||||||
# Get Windows ADK path from registry(following Visual Studio's winsdk.bat approach), trim the following backslash for path concatenation.
|
# Get Windows ADK path from registry(following Visual Studio's winsdk.bat approach).
|
||||||
$WinSDKPath = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots", "KitsRoot10", $null).TrimEnd('\')
|
$WinSDKPath = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots", "KitsRoot10", $null)
|
||||||
if ($null -ne $WinSDKPath) {
|
if ($null -ne $WinSDKPath) {
|
||||||
|
# Trim the following backslash for path concatenation.
|
||||||
|
$WinSDKPath = $WinSDKPath.TrimEnd('\')
|
||||||
$ADKDepTools = "$WinSDKPath\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
|
$ADKDepTools = "$WinSDKPath\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
|
||||||
}
|
}
|
||||||
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
|
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
|
||||||
|
|
|
||||||
|
|
@ -438,9 +438,11 @@ Write-Host "The tiny11 image is now completed. Proceeding with the making of the
|
||||||
Write-Host "Copying unattended file for bypassing MS account on OOBE..."
|
Write-Host "Copying unattended file for bypassing MS account on OOBE..."
|
||||||
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\tiny11\autounattend.xml" -Force | Out-Null
|
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\tiny11\autounattend.xml" -Force | Out-Null
|
||||||
Write-Host "Creating ISO image..."
|
Write-Host "Creating ISO image..."
|
||||||
# Get Windows ADK path from registry(following Visual Studio's winsdk.bat approach), trim the following backslash for path concatenation.
|
# Get Windows ADK path from registry(following Visual Studio's winsdk.bat approach).
|
||||||
$WinSDKPath = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots", "KitsRoot10", $null).TrimEnd('\')
|
$WinSDKPath = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots", "KitsRoot10", $null)
|
||||||
if ($null -ne $WinSDKPath) {
|
if ($null -ne $WinSDKPath) {
|
||||||
|
# Trim the following backslash for path concatenation.
|
||||||
|
$WinSDKPath = $WinSDKPath.TrimEnd('\')
|
||||||
$ADKDepTools = "$WinSDKPath\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
|
$ADKDepTools = "$WinSDKPath\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
|
||||||
}
|
}
|
||||||
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
|
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue