Fixing Microwin, no more errors and it creats image now without issues

This commit is contained in:
KonTy 2024-05-26 09:33:45 -07:00
parent d905bbf5d5
commit 03746956cf
3 changed files with 23 additions and 26 deletions

View File

@ -12,7 +12,7 @@ function Invoke-WPFGetIso {
return
}
$sync.BusyMessage.Visibility="Visible"
$sync.BusyMessage.Visibility="Visible"
$sync.BusyText.Text="N Busy"
@ -23,10 +23,6 @@ function Invoke-WPFGetIso {
Write-Host "\/ \/|_| \___||_| \___/ \/ \/ |_||_| |_| "
$oscdimgPath = Join-Path $env:TEMP 'oscdimg.exe'
if( ! (Test-Path $oscdimgPath -PathType Leaf) ) {
$oscdimgPath = Join-Path '.\releases\' 'oscdimg.exe'
}
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg.exe) -or (Test-Path $oscdimgPath -PathType Leaf)
Write-Host "oscdimg.exe on system: $oscdImgFound"
@ -131,8 +127,8 @@ function Invoke-WPFGetIso {
$sync.MicrowinIsoDrive.Text = $driveLetter
$mountedISOPath = (Split-Path -Path $filePath)
if ($sync.MicrowinScratchDirBox.Text.Trim() -eq "Scratch_Directory") {
$sync.MicrowinScratchDirBox.Text = ""
if ($sync.MicrowinScratchDirBox.Text.Trim() -eq "Scratch") {
$sync.MicrowinScratchDirBox.Text =""
}
$UseISOScratchDir = $sync.WPFMicrowinISOScratchDir.IsChecked

View File

@ -202,26 +202,27 @@ public class PowerManagement {
$desktopDir = "$($scratchDir)\Windows\Users\Default\Desktop"
New-Item -ItemType Directory -Force -Path "$desktopDir"
dism /English /image:$($scratchDir) /set-profilepath:"$($scratchDir)\Windows\Users\Default"
$command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'"
$shortcutPath = "$desktopDir\WinUtil.lnk"
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($shortcutPath)
if (Test-Path -Path "$env:TEMP\cttlogo.png")
{
$pngPath = "$env:TEMP\cttlogo.png"
$icoPath = "$env:TEMP\cttlogo.ico"
ConvertTo-Icon -bitmapPath $pngPath -iconPath $icoPath
Write-Host "ICO file created at: $icoPath"
Copy-Item "$env:TEMP\cttlogo.png" "$($scratchDir)\Windows\cttlogo.png" -force
Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\Windows\cttlogo.ico" -force
$shortcut.IconLocation = "c:\Windows\cttlogo.ico"
}
# $command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'"
# $shortcutPath = "$desktopDir\WinUtil.lnk"
# $shell = New-Object -ComObject WScript.Shell
# $shortcut = $shell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = "powershell.exe"
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
$shortcut.Save()
Write-Host "Shortcut to winutil created at: $shortcutPath"
# if (Test-Path -Path "$env:TEMP\cttlogo.png")
# {
# $pngPath = "$env:TEMP\cttlogo.png"
# $icoPath = "$env:TEMP\cttlogo.ico"
# ConvertTo-Icon -bitmapPath $pngPath -iconPath $icoPath
# Write-Host "ICO file created at: $icoPath"
# Copy-Item "$env:TEMP\cttlogo.png" "$($scratchDir)\Windows\cttlogo.png" -force
# Copy-Item "$env:TEMP\cttlogo.ico" "$($scratchDir)\Windows\cttlogo.ico" -force
# $shortcut.IconLocation = "c:\Windows\cttlogo.ico"
# }
# $shortcut.TargetPath = "powershell.exe"
# $shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
# $shortcut.Save()
# Write-Host "Shortcut to winutil created at: $shortcutPath"
# *************************** Automation black ***************************
Write-Host "Copy checkinstall.cmd into the ISO"

View File

@ -801,7 +801,7 @@
<ColumnDefinition Width="30" /> <!-- Fixed width for Button -->
</Grid.ColumnDefinitions>
<TextBox Name="MicrowinScratchDirBox" Background="Transparent" BorderBrush="{MainForegroundColor}"
Text="Scratch_Directory"
Text="Scratch"
Margin="2"
IsReadOnly="False"
ToolTip="Alt Path For Scratch Directory"