builder_0.1_.ps1 aktualisiert
This commit is contained in:
parent
e9d74443ff
commit
7baa848965
262
builder_0.1_.ps1
262
builder_0.1_.ps1
@ -1,131 +1,131 @@
|
||||
#
|
||||
# Treiber in ein Windows
|
||||
#
|
||||
|
||||
# Diese Variablen jeweils anpassen:
|
||||
# Installationspfad
|
||||
$droot = "C:\win11_slipstream"
|
||||
# Name und Ort der Qeull-ISO Datei
|
||||
$isoFile = "${droot}\Win11_24H2_German_x64.iso"
|
||||
|
||||
# -------------------------------------------------------------------------------
|
||||
# Ab hier nichts mehr ändern, außer Du weisst was Du tust!
|
||||
# -------------------------------------------------------------------------------
|
||||
$workPath = "${droot}\mount\work"
|
||||
$toolPath = "${droot}\tools"
|
||||
$isoPath = "${droot}\mount\ISO"
|
||||
$addFiles = "${droot}\addfiles"
|
||||
$wimPath = "${addFiles}\Sources"
|
||||
|
||||
|
||||
function CreateDirs {
|
||||
New-Item -ItemType Directory -Force -Path "${isoPath}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${workPath}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${addfiles}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${addfiles}\Updates" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${addfiles}\Sources" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${wimpath}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\mount\boot" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\mount\install" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\drivers\boot" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\drivers\install" > $null
|
||||
}
|
||||
function DiscardMounts {
|
||||
Write-Host "Lösche eventuelle Mounts"
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\boot /Discard
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\install /Discard
|
||||
}
|
||||
function CopyIso {
|
||||
Write-Host "Es wird die Datei ${isoFile} als Vorlage verwendet!"
|
||||
# mountet eine Windows .ISO Datei und merkt sich den Laufwerksbuchstaben -----------------------------
|
||||
$mountResult = Mount-DiskImage -ImagePath $isoFile -PassThru
|
||||
$driveLetter = ($mountResult | Get-Volume).DriveLetter
|
||||
Write-Host "Mounte .ISO Datei nach ${driveLetter}: ..."
|
||||
|
||||
# Kopiert die ISO auf das lokale Laufwerk ------------------------------------------------------------
|
||||
Write-Host "Kopiere Inhalt der .ISO ..."
|
||||
New-Item -ItemType Directory -Force -Path "$isoPath" > $null
|
||||
Copy-Item -Path "${driveLetter}:\*" -Destination "$isoPath" -Recurse -Force
|
||||
|
||||
if(-not(Test-Path "${wimPath}\boot.wim"))
|
||||
{
|
||||
Write-Host "Kopiere boot.wim ..."
|
||||
cp ${driveLetter}:\sources\boot.wim ${wimPath}
|
||||
attrib -R ${wimPath}\boot.wim
|
||||
} else {
|
||||
Write-Host "boot.wim ist bereits vorhanden und wird übersprungen."
|
||||
}
|
||||
if(-not(Test-Path "${wimPath}\install.wim"))
|
||||
{
|
||||
Write-Host "Kopiere install.wim..."
|
||||
cp ${driveLetter}:\sources\install.wim ${wimPath}
|
||||
attrib -R ${wimPath}\install.wim
|
||||
} else {
|
||||
Write-Host "install.wim ist bereits vorhanden und wird übersprungen."
|
||||
}
|
||||
|
||||
Write-Host "Kopieren abgeschlossen."
|
||||
|
||||
# Trenne .ISO Datei ----------------------------------------------------------------------------------
|
||||
Write-Host "Trenne .ISO Datei..."
|
||||
Dismount-DiskImage -ImagePath $isoFile
|
||||
}
|
||||
function ConvertEsd {
|
||||
# Achtung! Funktion ist unfertig!
|
||||
Write-Host "Konvertiere install.esd nach install.wim..."
|
||||
dism /get-wiminfo /wimfile:${droot}\install.esd
|
||||
dism /export-image /SourceImageFile:${droot}\install.esd /SourceIndex:5 /DestinationImageFile:${droot}\install.wim /Compress:max /CheckIntegrity
|
||||
attrib -R ${droot}\install.wim
|
||||
}
|
||||
function ModifiyBoot {
|
||||
# füge Treiber in das boot.wim Image ein
|
||||
Write-Host "Mounte die boot.wim..."
|
||||
Write-Host "Füge die Treiber unterhalb von drivers\boot in die boot.wim ein..."
|
||||
#dism /get-wiminfo /wimfile:${wimPath}\boot.wim
|
||||
DISM /Mount-Wim /WimFile:${wimPath}\boot.wim /Index:1 /MountDir:${droot}\mount\boot
|
||||
DISM /Image:${droot}\mount\boot /Add-Driver /Driver:${droot}\drivers\boot /recurse /forceunsigned
|
||||
Write-Host "Trenne boot.wim..."
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\boot /Commit
|
||||
}
|
||||
function ModifyInstall {
|
||||
# füge Treiber und Updates in das install.wim Image ein
|
||||
Write-Host "Mounte die install.wim..."
|
||||
Write-Host "Füge die Treiber unterhalb von drivers\install in die install.wim ein..."
|
||||
#dism /get-wiminfo /wimfile:${addFiles}\Sources\install.wim
|
||||
DISM /Mount-Wim /WimFile:${addFiles}\Sources\install.wim /Index:1 /MountDir:${droot}\mount\install
|
||||
DISM /Image:${droot}\mount\install /Add-Driver /Driver:${droot}\drivers\install /recurse /forceunsigned
|
||||
DISM /Image:${droot}\mount\install /add-package /PackagePath:${droot}\addfiles\updates
|
||||
Write-Host "Trenne install.wim..."
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\install /Commit
|
||||
}
|
||||
function CreateISO {
|
||||
Write-Host "Erstelle neues Windows-Image ..."
|
||||
Write-Host " kopiere originale ISO Dateien ..."
|
||||
cp ${isoPath}\* ${workPath} -Recurse -Force
|
||||
|
||||
Write-Host " kopiere zusäzliche Dateien ..."
|
||||
cp ${addFiles}\* ${workPath} -Recurse -Force
|
||||
|
||||
Write-Host "Erstelle bootable.iso ..."
|
||||
# $toolPath\oscdimg.exe -b"${toolPath}\efisys.bin" -udfver102 -u2 -h -m -o ${workPath} ${droot}\bootable.iso
|
||||
Start-Process -Filepath "$toolPath\oscdimg.exe" -ArgumentList "-b`"${toolPath}\efisys.bin`" -udfver102 -u2 -h -m -o ${workPath} ${droot}\bootable.isoLossBeNing"
|
||||
}
|
||||
function CleanUp {
|
||||
Write-Host "Räume auf..."
|
||||
# HKLM\SOFTWARE\Microsoft\WIMMount\mounted images\
|
||||
DISM /Cleanup-Wim
|
||||
DISM /Get-MountedImageInfo
|
||||
DISM /Get-MountedWimInfo
|
||||
}
|
||||
|
||||
<#
|
||||
|
||||
DiscardMounts
|
||||
CreateDirs
|
||||
CopyIso
|
||||
ModifyBoot
|
||||
ModifyInstall
|
||||
CleanUp
|
||||
CreateISO
|
||||
|
||||
#>
|
||||
#
|
||||
# Treiber in ein Windows
|
||||
#
|
||||
|
||||
# Diese Variablen jeweils anpassen:
|
||||
# Installationspfad
|
||||
$droot = "C:\win11_slipstream"
|
||||
# Name und Ort der Qeull-ISO Datei
|
||||
$isoFile = "${droot}\Win11_24H2_German_x64.iso"
|
||||
|
||||
# -------------------------------------------------------------------------------
|
||||
# Ab hier nichts mehr ändern, außer Du weisst was Du tust!
|
||||
# -------------------------------------------------------------------------------
|
||||
$workPath = "${droot}\mount\work"
|
||||
$toolPath = "${droot}\tools"
|
||||
$isoPath = "${droot}\mount\ISO"
|
||||
$addFiles = "${droot}\addfiles"
|
||||
$wimPath = "${addFiles}\Sources"
|
||||
|
||||
|
||||
function CreateDirs {
|
||||
New-Item -ItemType Directory -Force -Path "${isoPath}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${workPath}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${addfiles}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${addfiles}\Updates" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${addfiles}\Sources" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${wimpath}" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\mount\boot" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\mount\install" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\drivers\boot" > $null
|
||||
New-Item -ItemType Directory -Force -Path "${droot}\drivers\install" > $null
|
||||
}
|
||||
function DiscardMounts {
|
||||
Write-Host "Lösche eventuelle Mounts"
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\boot /Discard
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\install /Discard
|
||||
}
|
||||
function CopyIso {
|
||||
Write-Host "Es wird die Datei ${isoFile} als Vorlage verwendet!"
|
||||
# mountet eine Windows .ISO Datei und merkt sich den Laufwerksbuchstaben -----------------------------
|
||||
$mountResult = Mount-DiskImage -ImagePath $isoFile -PassThru
|
||||
$driveLetter = ($mountResult | Get-Volume).DriveLetter
|
||||
Write-Host "Mounte .ISO Datei nach ${driveLetter}: ..."
|
||||
|
||||
# Kopiert die ISO auf das lokale Laufwerk ------------------------------------------------------------
|
||||
Write-Host "Kopiere Inhalt der .ISO ..."
|
||||
New-Item -ItemType Directory -Force -Path "$isoPath" > $null
|
||||
Copy-Item -Path "${driveLetter}:\*" -Destination "$isoPath" -Recurse -Force
|
||||
|
||||
if(-not(Test-Path "${wimPath}\boot.wim"))
|
||||
{
|
||||
Write-Host "Kopiere boot.wim ..."
|
||||
cp ${driveLetter}:\sources\boot.wim ${wimPath}
|
||||
attrib -R ${wimPath}\boot.wim
|
||||
} else {
|
||||
Write-Host "boot.wim ist bereits vorhanden und wird übersprungen."
|
||||
}
|
||||
if(-not(Test-Path "${wimPath}\install.wim"))
|
||||
{
|
||||
Write-Host "Kopiere install.wim..."
|
||||
cp ${driveLetter}:\sources\install.wim ${wimPath}
|
||||
attrib -R ${wimPath}\install.wim
|
||||
} else {
|
||||
Write-Host "install.wim ist bereits vorhanden und wird übersprungen."
|
||||
}
|
||||
|
||||
Write-Host "Kopieren abgeschlossen."
|
||||
|
||||
# Trenne .ISO Datei ----------------------------------------------------------------------------------
|
||||
Write-Host "Trenne .ISO Datei..."
|
||||
Dismount-DiskImage -ImagePath $isoFile
|
||||
}
|
||||
function ConvertEsd {
|
||||
# Achtung! Funktion ist unfertig!
|
||||
Write-Host "Konvertiere install.esd nach install.wim..."
|
||||
dism /get-wiminfo /wimfile:${droot}\install.esd
|
||||
dism /export-image /SourceImageFile:${droot}\install.esd /SourceIndex:5 /DestinationImageFile:${droot}\install.wim /Compress:max /CheckIntegrity
|
||||
attrib -R ${droot}\install.wim
|
||||
}
|
||||
function ModifiyBoot {
|
||||
# füge Treiber in das boot.wim Image ein
|
||||
Write-Host "Mounte die boot.wim..."
|
||||
Write-Host "Füge die Treiber unterhalb von drivers\boot in die boot.wim ein..."
|
||||
#dism /get-wiminfo /wimfile:${wimPath}\boot.wim
|
||||
DISM /Mount-Wim /WimFile:${wimPath}\boot.wim /Index:1 /MountDir:${droot}\mount\boot
|
||||
DISM /Image:${droot}\mount\boot /Add-Driver /Driver:${droot}\drivers\boot /recurse /forceunsigned
|
||||
Write-Host "Trenne boot.wim..."
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\boot /Commit
|
||||
}
|
||||
function ModifyInstall {
|
||||
# füge Treiber und Updates in das install.wim Image ein
|
||||
Write-Host "Mounte die install.wim..."
|
||||
Write-Host "Füge die Treiber unterhalb von drivers\install in die install.wim ein..."
|
||||
#dism /get-wiminfo /wimfile:${addFiles}\Sources\install.wim
|
||||
DISM /Mount-Wim /WimFile:${addFiles}\Sources\install.wim /Index:1 /MountDir:${droot}\mount\install
|
||||
DISM /Image:${droot}\mount\install /Add-Driver /Driver:${droot}\drivers\install /recurse /forceunsigned
|
||||
DISM /Image:${droot}\mount\install /add-package /PackagePath:${droot}\addfiles\updates
|
||||
Write-Host "Trenne install.wim..."
|
||||
DISM /Unmount-Wim /MountDir:${droot}\mount\install /Commit
|
||||
}
|
||||
function CreateISO {
|
||||
Write-Host "Erstelle neues Windows-Image ..."
|
||||
Write-Host " kopiere originale ISO Dateien ..."
|
||||
cp ${isoPath}\* ${workPath} -Recurse -Force
|
||||
|
||||
Write-Host " kopiere zusäzliche Dateien ..."
|
||||
cp ${addFiles}\* ${workPath} -Recurse -Force
|
||||
|
||||
Write-Host "Erstelle bootable.iso ..."
|
||||
# $toolPath\oscdimg.exe -b"${toolPath}\efisys.bin" -udfver102 -u2 -h -m -o ${workPath} ${droot}\bootable.iso
|
||||
Start-Process -Filepath "$toolPath\oscdimg.exe" -ArgumentList "-b`"${toolPath}\efisys.bin`" -udfver102 -u2 -h -m -o ${workPath} ${droot}\bootable.iso"
|
||||
}
|
||||
function CleanUp {
|
||||
Write-Host "Räume auf..."
|
||||
# HKLM\SOFTWARE\Microsoft\WIMMount\mounted images\
|
||||
DISM /Cleanup-Wim
|
||||
DISM /Get-MountedImageInfo
|
||||
DISM /Get-MountedWimInfo
|
||||
}
|
||||
|
||||
<#
|
||||
|
||||
DiscardMounts
|
||||
CreateDirs
|
||||
CopyIso
|
||||
ModifyBoot
|
||||
ModifyInstall
|
||||
CleanUp
|
||||
CreateISO
|
||||
|
||||
#>
|
||||
|
Loading…
x
Reference in New Issue
Block a user