2016-02: Retroactive Updates

This commit is contained in:
Alan Mason 2017-11-24 20:54:40 -08:00
parent 41272c03ab
commit 4ed08ebb9b
13 changed files with 1399 additions and 740 deletions

5
System32/Winpeshl.ini Normal file
View file

@ -0,0 +1,5 @@
[LaunchApp]
[LaunchApps]
wpeinit
wpeutil updatebootinfo
"%SystemDrive%\WK\ConEmu\ConEmu64.exe", /cmd PowerShell -ExecutionPolicy Bypass "%SystemDrive%\WK\Scripts\WK.ps1" -new_console:n

View file

@ -12,7 +12,7 @@ for %%f in (%*) do (
) )
:LaunchMenu :LaunchMenu
PowerShell -ExecutionPolicy Bypass %systemdrive%\WK\Scripts\WK.ps1 "%SystemDrive%\WK\ConEmu\ConEmu64.exe" /cmd PowerShell -ExecutionPolicy Bypass "%SystemDrive%\WK\Scripts\WK.ps1" -new_console:n
goto Done goto Done
:Abort :Abort
@ -27,10 +27,5 @@ goto Exit
:Exit :Exit
echo. echo.
rem echo Press any key to exit...
rem pause>nul
popd popd
endlocal endlocal
cls
echo Careful now...
echo.

643
WK/ConEmu/ConEmu.xml Normal file
View file

@ -0,0 +1,643 @@
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2016-02-08 00:02:27" build="150813f">
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{Shells::PowerShell}"/>
<value name="StartFarFolders" type="hex" data="00"/>
<value name="StartFarEditors" type="hex" data="00"/>
<value name="ColorTable00" type="dword" data="00000000"/>
<value name="ColorTable01" type="dword" data="00ee0000"/>
<value name="ColorTable02" type="dword" data="0000cd00"/>
<value name="ColorTable03" type="dword" data="00cdcd00"/>
<value name="ColorTable04" type="dword" data="000000cd"/>
<value name="ColorTable05" type="dword" data="00cd00cd"/>
<value name="ColorTable06" type="dword" data="0000cdcd"/>
<value name="ColorTable07" type="dword" data="00e5e5e5"/>
<value name="ColorTable08" type="dword" data="007f7f7f"/>
<value name="ColorTable09" type="dword" data="00ff5c5c"/>
<value name="ColorTable10" type="dword" data="0000ff00"/>
<value name="ColorTable11" type="dword" data="00ffff00"/>
<value name="ColorTable12" type="dword" data="000000ff"/>
<value name="ColorTable13" type="dword" data="00ff00ff"/>
<value name="ColorTable14" type="dword" data="0000ffff"/>
<value name="ColorTable15" type="dword" data="00ffffff"/>
<value name="ColorTable16" type="dword" data="00000000"/>
<value name="ColorTable17" type="dword" data="00800000"/>
<value name="ColorTable18" type="dword" data="00008000"/>
<value name="ColorTable19" type="dword" data="00808000"/>
<value name="ColorTable20" type="dword" data="00000080"/>
<value name="ColorTable21" type="dword" data="00800080"/>
<value name="ColorTable22" type="dword" data="00008080"/>
<value name="ColorTable23" type="dword" data="00c0c0c0"/>
<value name="ColorTable24" type="dword" data="00808080"/>
<value name="ColorTable25" type="dword" data="00ff0000"/>
<value name="ColorTable26" type="dword" data="0000ff00"/>
<value name="ColorTable27" type="dword" data="00ffff00"/>
<value name="ColorTable28" type="dword" data="000000ff"/>
<value name="ColorTable29" type="dword" data="00ff00ff"/>
<value name="ColorTable30" type="dword" data="0000ffff"/>
<value name="ColorTable31" type="dword" data="00ffffff"/>
<value name="ExtendColors" type="hex" data="00"/>
<value name="ExtendColorIdx" type="hex" data="0e"/>
<value name="TextColorIdx" type="hex" data="10"/>
<value name="BackColorIdx" type="hex" data="10"/>
<value name="PopTextColorIdx" type="hex" data="10"/>
<value name="PopBackColorIdx" type="hex" data="10"/>
<value name="SingleInstance" type="hex" data="00"/>
<value name="QuakeStyle" type="hex" data="00"/>
<value name="KeyboardHooks" type="hex" data="01"/>
<value name="UseInjects" type="hex" data="01"/>
<value name="Update.CheckOnStartup" type="hex" data="00"/>
<value name="Update.CheckHourly" type="hex" data="00"/>
<value name="Update.ConfirmDownload" type="hex" data="01"/>
<value name="Update.UseBuilds" type="hex" data="02"/>
<value name="FontUseDpi" type="hex" data="01"/>
<value name="FontUseUnits" type="hex" data="01"/>
<value name="FontSize" type="dword" data="0000000e"/>
<value name="StatusFontHeight" type="dword" data="0000000c"/>
<value name="TabFontHeight" type="dword" data="0000000d"/>
<key name="HotKeys" modified="2016-02-08 00:02:27" build="150813f">
<value name="MinimizeRestore" type="dword" data="000011c0"/>
<value name="KeyMacroVersion" type="hex" data="02"/>
<value name="Multi.Modifier" type="dword" data="0000005b"/>
<value name="Multi.ArrowsModifier" type="dword" data="0000005b"/>
<value name="MinimizeRestore2" type="dword" data="00000000"/>
<value name="GlobalRestore" type="dword" data="00000000"/>
<value name="CdExplorerPath" type="dword" data="00000000"/>
<value name="ForcedFullScreen" type="dword" data="12115b0d"/>
<value name="SwitchGuiFocus" type="dword" data="00005b5a"/>
<value name="SetFocusGui" type="dword" data="00000000"/>
<value name="SetFocusChild" type="dword" data="00000000"/>
<value name="ChildSystemMenu" type="dword" data="00000000"/>
<value name="Multi.NewConsole" type="dword" data="00005b57"/>
<value name="Multi.NewConsoleShift" type="dword" data="00105b57"/>
<value name="Multi.CmdKey" type="dword" data="00005b58"/>
<value name="Multi.NewWindow" type="dword" data="00000000"/>
<value name="Multi.NewConsolePopup" type="dword" data="00005b4e"/>
<value name="Multi.NewConsolePopup2" type="dword" data="00000000"/>
<value name="Multi.NewAttach" type="dword" data="00005b47"/>
<value name="Multi.NewSplitV" type="dword" data="0010114f"/>
<value name="Multi.NewSplitH" type="dword" data="00101145"/>
<value name="Multi.SplitMaximize" type="dword" data="00005d0d"/>
<value name="Multi.SplitSizeVU" type="dword" data="00105d26"/>
<value name="Multi.SplitSizeVD" type="dword" data="00105d28"/>
<value name="Multi.SplitSizeHL" type="dword" data="00105d25"/>
<value name="Multi.SplitSizeHR" type="dword" data="00105d27"/>
<value name="Key.TabPane1" type="dword" data="00005d09"/>
<value name="Key.TabPane2" type="dword" data="00105d09"/>
<value name="Multi.SplitFocusU" type="dword" data="00005d26"/>
<value name="Multi.SplitFocusD" type="dword" data="00005d28"/>
<value name="Multi.SplitFocusL" type="dword" data="00005d25"/>
<value name="Multi.SplitFocusR" type="dword" data="00005d27"/>
<value name="Multi.Next" type="dword" data="00005b51"/>
<value name="Multi.NextShift" type="dword" data="00105b51"/>
<value name="Multi.Recreate" type="dword" data="00005bc0"/>
<value name="Multi.AltCon" type="dword" data="00005b41"/>
<value name="Multi.Pause" type="dword" data="80808013"/>
<value name="Multi.Scroll" type="dword" data="00000000"/>
<value name="Multi.GroupInput" type="dword" data="00005d47"/>
<value name="Multi.Detach" type="dword" data="00000000"/>
<value name="Multi.Unfasten" type="dword" data="00000000"/>
<value name="Multi.Close" type="dword" data="00005b2e"/>
<value name="CloseTabKey" type="dword" data="00125b2e"/>
<value name="CloseGroupKey" type="dword" data="00115b2e"/>
<value name="CloseGroupPrcKey" type="dword" data="00000000"/>
<value name="CloseAllConKey" type="dword" data="00000000"/>
<value name="CloseZombiesKey" type="dword" data="00000000"/>
<value name="CloseExceptConKey" type="dword" data="00000000"/>
<value name="KillProcessKey" type="dword" data="00000000"/>
<value name="KillAllButShellKey" type="dword" data="00105b2e"/>
<value name="DuplicateRootKey" type="dword" data="00005b53"/>
<value name="CloseConEmuKey" type="dword" data="00005b73"/>
<value name="Multi.Rename" type="dword" data="00005d52"/>
<value name="AffinityPriorityKey" type="dword" data="00005d41"/>
<value name="Multi.MoveLeft" type="dword" data="00125b25"/>
<value name="Multi.MoveRight" type="dword" data="00125b27"/>
<value name="CTS.VkBlockStart" type="dword" data="00000000"/>
<value name="CTS.VkTextStart" type="dword" data="00000000"/>
<value name="CTS.VkCopyFmt0" type="dword" data="00001143"/>
<value name="CTS.VkCopyFmt1" type="dword" data="00101143"/>
<value name="CTS.VkCopyFmt2" type="dword" data="00000000"/>
<value name="CTS.VkCopyAll" type="dword" data="00000000"/>
<value name="HighlightMouseSwitch" type="dword" data="00005d4c"/>
<value name="HighlightMouseSwitchX" type="dword" data="00005d58"/>
<value name="Multi.ShowTabsList" type="dword" data="00000000"/>
<value name="Multi.ShowTabsList2" type="dword" data="00005d7b"/>
<value name="ClipboardVkAllLines" type="dword" data="0000102d"/>
<value name="ClipboardVkFirstLine" type="dword" data="00001156"/>
<value name="DeleteWordToLeft" type="dword" data="00001108"/>
<value name="FindTextKey" type="dword" data="00005d46"/>
<value name="ScreenshotKey" type="dword" data="00005b48"/>
<value name="ScreenshotFullKey" type="dword" data="00105b48"/>
<value name="ShowStatusBarKey" type="dword" data="00005d53"/>
<value name="ShowTabBarKey" type="dword" data="00005d54"/>
<value name="ShowCaptionKey" type="dword" data="00005d43"/>
<value name="AlwaysOnTopKey" type="dword" data="00000000"/>
<value name="TransparencyInc" type="dword" data="00000000"/>
<value name="TransparencyDec" type="dword" data="00000000"/>
<value name="Key.TabMenu" type="dword" data="00005d20"/>
<value name="Key.TabMenu2" type="dword" data="00001002"/>
<value name="Key.Maximize" type="dword" data="00001278"/>
<value name="Key.MaximizeWidth" type="dword" data="00105b28"/>
<value name="Key.MaximizeHeight" type="dword" data="00105b26"/>
<value name="Key.TileToLeft" type="dword" data="00005b25"/>
<value name="Key.TileToRight" type="dword" data="00005b27"/>
<value name="Key.JumpPrevMonitor" type="dword" data="00105b25"/>
<value name="Key.JumpNextMonitor" type="dword" data="00105b27"/>
<value name="Key.FullScreen" type="dword" data="0000120d"/>
<value name="Key.SysMenu" type="dword" data="00001220"/>
<value name="Key.SysMenu2" type="dword" data="00001102"/>
<value name="Key.BufUp" type="dword" data="00001126"/>
<value name="Key.BufDn" type="dword" data="00001128"/>
<value name="Key.BufPgUp" type="dword" data="00001121"/>
<value name="Key.BufPgDn" type="dword" data="00001122"/>
<value name="Key.BufHfPgUp" type="dword" data="00005d21"/>
<value name="Key.BufHfPgDn" type="dword" data="00005d22"/>
<value name="Key.BufTop" type="dword" data="00005d24"/>
<value name="Key.BufBottom" type="dword" data="00005d23"/>
<value name="Key.BufCursor" type="dword" data="00005d08"/>
<value name="FontLargerKey" type="dword" data="000011d0"/>
<value name="FontSmallerKey" type="dword" data="000011d1"/>
<value name="FontOriginalKey" type="dword" data="00001104"/>
<value name="PasteFileKey" type="dword" data="00101146"/>
<value name="PastePathKey" type="dword" data="00101144"/>
<value name="PasteCygwinKey" type="dword" data="00005d2d"/>
<value name="KeyMacro01" type="dword" data="00000000"/>
<value name="KeyMacro01.Text" type="string" data=""/>
<value name="KeyMacro02" type="dword" data="00000000"/>
<value name="KeyMacro02.Text" type="string" data=""/>
<value name="KeyMacro03" type="dword" data="00000000"/>
<value name="KeyMacro03.Text" type="string" data=""/>
<value name="KeyMacro04" type="dword" data="00000000"/>
<value name="KeyMacro04.Text" type="string" data=""/>
<value name="KeyMacro05" type="dword" data="00000000"/>
<value name="KeyMacro05.Text" type="string" data=""/>
<value name="KeyMacro06" type="dword" data="00000000"/>
<value name="KeyMacro06.Text" type="string" data=""/>
<value name="KeyMacro07" type="dword" data="00000000"/>
<value name="KeyMacro07.Text" type="string" data=""/>
<value name="KeyMacro08" type="dword" data="00000000"/>
<value name="KeyMacro08.Text" type="string" data=""/>
<value name="KeyMacro09" type="dword" data="00000000"/>
<value name="KeyMacro09.Text" type="string" data=""/>
<value name="KeyMacro10" type="dword" data="00000000"/>
<value name="KeyMacro10.Text" type="string" data=""/>
<value name="KeyMacro11" type="dword" data="00000000"/>
<value name="KeyMacro11.Text" type="string" data=""/>
<value name="KeyMacro12" type="dword" data="00000000"/>
<value name="KeyMacro12.Text" type="string" data=""/>
<value name="KeyMacro13" type="dword" data="00000000"/>
<value name="KeyMacro13.Text" type="string" data=""/>
<value name="KeyMacro14" type="dword" data="00000000"/>
<value name="KeyMacro14.Text" type="string" data=""/>
<value name="KeyMacro15" type="dword" data="00000000"/>
<value name="KeyMacro15.Text" type="string" data=""/>
<value name="KeyMacro16" type="dword" data="00000000"/>
<value name="KeyMacro16.Text" type="string" data=""/>
<value name="KeyMacro17" type="dword" data="00000000"/>
<value name="KeyMacro17.Text" type="string" data=""/>
<value name="KeyMacro18" type="dword" data="00000000"/>
<value name="KeyMacro18.Text" type="string" data=""/>
<value name="KeyMacro19" type="dword" data="00000000"/>
<value name="KeyMacro19.Text" type="string" data=""/>
<value name="KeyMacro20" type="dword" data="00000000"/>
<value name="KeyMacro20.Text" type="string" data=""/>
<value name="KeyMacro21" type="dword" data="00000000"/>
<value name="KeyMacro21.Text" type="string" data=""/>
<value name="KeyMacro22" type="dword" data="00000000"/>
<value name="KeyMacro22.Text" type="string" data=""/>
<value name="KeyMacro23" type="dword" data="00000000"/>
<value name="KeyMacro23.Text" type="string" data=""/>
<value name="KeyMacro24" type="dword" data="00000000"/>
<value name="KeyMacro24.Text" type="string" data=""/>
<value name="KeyMacro25" type="dword" data="00000000"/>
<value name="KeyMacro25.Text" type="string" data=""/>
<value name="KeyMacro26" type="dword" data="00000000"/>
<value name="KeyMacro26.Text" type="string" data=""/>
<value name="KeyMacro27" type="dword" data="00000000"/>
<value name="KeyMacro27.Text" type="string" data=""/>
<value name="KeyMacro28" type="dword" data="00000000"/>
<value name="KeyMacro28.Text" type="string" data=""/>
<value name="KeyMacro29" type="dword" data="00000000"/>
<value name="KeyMacro29.Text" type="string" data=""/>
<value name="KeyMacro30" type="dword" data="00000000"/>
<value name="KeyMacro30.Text" type="string" data=""/>
<value name="KeyMacro31" type="dword" data="00000000"/>
<value name="KeyMacro31.Text" type="string" data=""/>
<value name="KeyMacro32" type="dword" data="00000000"/>
<value name="KeyMacro32.Text" type="string" data=""/>
<value name="CTS.VkBlock" type="hex" data="a4"/>
<value name="CTS.VkText" type="hex" data="a0"/>
<value name="CTS.VkAct" type="hex" data="00"/>
<value name="CTS.VkPrompt" type="hex" data="00"/>
<value name="FarGotoEditorVk" type="hex" data="a2"/>
<value name="DndLKey" type="hex" data="00"/>
<value name="DndRKey" type="hex" data="a2"/>
<value name="WndDragKey" type="dword" data="00121101"/>
</key>
<value name="UseCurrentSizePos" type="hex" data="00"/>
<value name="WindowMode" type="dword" data="0000051f"/>
<value name="ConWnd Width" type="dword" data="0200005a"/>
<value name="ConWnd Height" type="dword" data="0200005a"/>
<value name="Cascaded" type="hex" data="00"/>
<value name="IntegralSize" type="hex" data="00"/>
<value name="ConWnd X" type="dword" data="00000032"/>
<value name="ConWnd Y" type="dword" data="00000032"/>
<value name="16bit Height" type="dword" data="00000000"/>
<value name="AutoSaveSizePos" type="hex" data="00"/>
<value name="StartCreateDelay" type="dword" data="00000064"/>
<value name="ExtendFonts" type="hex" data="00"/>
<value name="ExtendFontNormalIdx" type="hex" data="01"/>
<value name="ExtendFontBoldIdx" type="hex" data="0c"/>
<value name="ExtendFontItalicIdx" type="hex" data="0d"/>
<value name="CursorTypeActive" type="dword" data="000232c1"/>
<value name="CursorTypeInactive" type="dword" data="00823283"/>
<value name="ClipboardDetectLineEnd" type="hex" data="01"/>
<value name="ClipboardBashMargin" type="hex" data="00"/>
<value name="ClipboardTrimTrailing" type="hex" data="02"/>
<value name="ClipboardEOL" type="hex" data="00"/>
<value name="ClipboardArrowStart" type="hex" data="01"/>
<value name="ClipboardAllLines" type="hex" data="01"/>
<value name="ClipboardFirstLine" type="hex" data="01"/>
<value name="ClipboardClickPromptPosition" type="hex" data="02"/>
<value name="ClipboardDeleteLeftWord" type="hex" data="02"/>
<value name="TrueColorerSupport" type="hex" data="01"/>
<value name="FadeInactive" type="hex" data="01"/>
<value name="FadeInactiveLow" type="hex" data="00"/>
<value name="FadeInactiveHigh" type="hex" data="d0"/>
<value name="ConVisible" type="hex" data="00"/>
<value name="SetDefaultTerminal" type="hex" data="00"/>
<value name="SetDefaultTerminalStartup" type="hex" data="00"/>
<value name="SetDefaultTerminalStartupTSA" type="hex" data="00"/>
<value name="DefaultTerminalAgressive" type="hex" data="01"/>
<value name="DefaultTerminalNoInjects" type="hex" data="00"/>
<value name="DefaultTerminalNewWindow" type="hex" data="00"/>
<value name="DefaultTerminalDebugLog" type="hex" data="00"/>
<value name="DefaultTerminalConfirm" type="hex" data="01"/>
<value name="DefaultTerminalApps" type="string" data="explorer.exe"/>
<value name="ProcessAnsi" type="hex" data="01"/>
<value name="AnsiLog" type="hex" data="00"/>
<value name="AnsiLogPath" type="string" data="%ConEmuDir%\Logs\"/>
<value name="ProcessNewConArg" type="hex" data="01"/>
<value name="ProcessCmdStart" type="hex" data="01"/>
<value name="ConsoleExceptionHandler" type="hex" data="00"/>
<value name="UseClink" type="hex" data="01"/>
<value name="StoreTaskbarkTasks" type="hex" data="00"/>
<value name="StoreTaskbarCommands" type="hex" data="00"/>
<value name="SaveCmdHistory" type="hex" data="01"/>
<value name="ShowHelpTooltips" type="hex" data="01"/>
<value name="Multi" type="hex" data="00"/>
<value name="Multi.ShowButtons" type="hex" data="00"/>
<value name="Multi.ShowSearch" type="hex" data="00"/>
<value name="Multi.NumberInCaption" type="hex" data="00"/>
<value name="Multi.CloseConfirmFlags" type="hex" data="04"/>
<value name="Multi.NewConfirm" type="hex" data="00"/>
<value name="Multi.DupConfirm" type="hex" data="01"/>
<value name="Multi.DetachConfirm" type="hex" data="01"/>
<value name="Multi.UseArrows" type="hex" data="00"/>
<value name="Multi.UseNumbers" type="hex" data="01"/>
<value name="Multi.UseWinTab" type="hex" data="00"/>
<value name="Multi.AutoCreate" type="hex" data="00"/>
<value name="Multi.LeaveOnClose" type="hex" data="00"/>
<value name="Multi.HideOnClose" type="hex" data="00"/>
<value name="Multi.MinByEsc" type="hex" data="02"/>
<value name="MapShiftEscToEsc" type="hex" data="01"/>
<value name="Multi.Iterate" type="hex" data="01"/>
<value name="Multi.SplitWidth" type="hex" data="04"/>
<value name="Multi.SplitHeight" type="hex" data="04"/>
<value name="FontName" type="string" data="Consolas"/>
<value name="FontName2" type="string" data="Consolas"/>
<value name="FontAutoSize" type="hex" data="00"/>
<value name="FontSizeX" type="dword" data="00000000"/>
<value name="FontSizeX2" type="dword" data="00000000"/>
<value name="FontSizeX3" type="dword" data="00000000"/>
<value name="FontCharSet" type="hex" data="00"/>
<value name="Anti-aliasing" type="dword" data="00000006"/>
<value name="FontBold" type="hex" data="00"/>
<value name="FontItalic" type="hex" data="00"/>
<value name="Monospace" type="hex" data="01"/>
<value name="BackGround Image show" type="hex" data="01"/>
<value name="BackGround Image" type="string" data="winpe.jpg"/>
<value name="bgImageDarker" type="hex" data="64"/>
<value name="bgImageColors" type="dword" data="ffffffff"/>
<value name="bgOperation" type="hex" data="07"/>
<value name="bgPluginAllowed" type="hex" data="01"/>
<value name="AlphaValue" type="hex" data="ff"/>
<value name="AlphaValueSeparate" type="hex" data="00"/>
<value name="AlphaValueInactive" type="hex" data="ff"/>
<value name="UserScreenTransparent" type="hex" data="00"/>
<value name="ColorKeyTransparent" type="hex" data="00"/>
<value name="ColorKeyValue" type="dword" data="00010101"/>
<value name="QuakeAnimation" type="dword" data="0000012c"/>
<value name="HideCaption" type="hex" data="00"/>
<value name="HideChildCaption" type="hex" data="01"/>
<value name="FocusInChildWindows" type="hex" data="01"/>
<value name="HideCaptionAlways" type="hex" data="00"/>
<value name="HideCaptionAlwaysFrame" type="hex" data="ff"/>
<value name="HideCaptionAlwaysDelay" type="dword" data="000007d0"/>
<value name="HideCaptionAlwaysDisappear" type="dword" data="000007d0"/>
<value name="DownShowHiddenMessage" type="hex" data="00"/>
<value name="DownShowExOnTopMessage" type="hex" data="00"/>
<value name="ConsoleFontName" type="string" data="Lucida Console"/>
<value name="ConsoleFontWidth" type="dword" data="00000003"/>
<value name="ConsoleFontHeight" type="dword" data="00000005"/>
<value name="DefaultBufferHeight" type="dword" data="000003e8"/>
<value name="AutoBufferHeight" type="hex" data="01"/>
<value name="UseScrollLock" type="hex" data="01"/>
<value name="CmdOutputCP" type="dword" data="00000000"/>
<value name="ComSpec.Type" type="hex" data="00"/>
<value name="ComSpec.Bits" type="hex" data="00"/>
<value name="ComSpec.UpdateEnv" type="hex" data="00"/>
<value name="ComSpec.EnvAddPath" type="hex" data="00"/>
<value name="ComSpec.EnvAddExePath" type="hex" data="00"/>
<value name="ComSpec.UncPaths" type="hex" data="00"/>
<value name="ComSpec.Path" type="string" data=""/>
<value name="EnvironmentSet" type="multi"/>
<value name="CTS.Intelligent" type="hex" data="01"/>
<value name="CTS.IntelligentExceptions" type="string" data="far|vim"/>
<value name="CTS.AutoCopy" type="hex" data="01"/>
<value name="CTS.IBeam" type="hex" data="01"/>
<value name="CTS.EndOnTyping" type="hex" data="00"/>
<value name="CTS.EndOnKeyPress" type="hex" data="00"/>
<value name="CTS.Freeze" type="hex" data="00"/>
<value name="CTS.SelectBlock" type="hex" data="01"/>
<value name="CTS.SelectText" type="hex" data="01"/>
<value name="CTS.HtmlFormat" type="hex" data="00"/>
<value name="CTS.ForceLocale" type="dword" data="00000000"/>
<value name="CTS.ActMode" type="hex" data="02"/>
<value name="CTS.RBtnAction" type="hex" data="03"/>
<value name="CTS.MBtnAction" type="hex" data="00"/>
<value name="CTS.ColorIndex" type="hex" data="e0"/>
<value name="ClipboardConfirmEnter" type="hex" data="01"/>
<value name="ClipboardConfirmLonger" type="dword" data="000000c8"/>
<value name="FarGotoEditorOpt" type="hex" data="01"/>
<value name="FarGotoEditorPath" type="string" data="far.exe /e%1:%2 &quot;%3&quot;"/>
<value name="HighlightMouseRow" type="hex" data="00"/>
<value name="HighlightMouseCol" type="hex" data="00"/>
<value name="FixFarBorders" type="hex" data="01"/>
<value name="FixFarBordersRanges" type="string" data="2013-25C4;"/>
<value name="ExtendUCharMap" type="hex" data="01"/>
<value name="EnhanceGraphics" type="hex" data="01"/>
<value name="EnhanceButtons" type="hex" data="00"/>
<value name="PartBrush75" type="hex" data="c8"/>
<value name="PartBrush50" type="hex" data="96"/>
<value name="PartBrush25" type="hex" data="5a"/>
<value name="PartBrushBlack" type="hex" data="20"/>
<value name="RightClick opens context menu" type="hex" data="02"/>
<value name="RightClickMacro2" type="string" data=""/>
<value name="SendAltTab" type="hex" data="00"/>
<value name="SendAltEsc" type="hex" data="00"/>
<value name="SendAltPrintScrn" type="hex" data="00"/>
<value name="SendPrintScrn" type="hex" data="00"/>
<value name="SendCtrlEsc" type="hex" data="00"/>
<value name="Min2Tray" type="hex" data="00"/>
<value name="AlwaysShowTrayIcon" type="hex" data="01"/>
<value name="SafeFarClose" type="hex" data="01"/>
<value name="SafeFarCloseMacro" type="string" data=""/>
<value name="FARuseASCIIsort" type="hex" data="00"/>
<value name="ShellNoZoneCheck" type="hex" data="00"/>
<value name="FixAltOnAltTab" type="hex" data="00"/>
<value name="DisableMouse" type="hex" data="00"/>
<value name="RSelectionFix" type="hex" data="01"/>
<value name="MouseSkipActivation" type="hex" data="01"/>
<value name="MouseSkipMoving" type="hex" data="01"/>
<value name="FarHourglass" type="hex" data="01"/>
<value name="FarHourglassDelay" type="dword" data="000001f4"/>
<value name="Dnd" type="hex" data="01"/>
<value name="DndDrop" type="hex" data="01"/>
<value name="DefCopy" type="hex" data="01"/>
<value name="DropUseMenu" type="hex" data="02"/>
<value name="DragOverlay" type="hex" data="01"/>
<value name="DragShowIcons" type="hex" data="01"/>
<value name="DebugSteps" type="hex" data="01"/>
<value name="DragPanel" type="hex" data="02"/>
<value name="DragPanelBothEdges" type="hex" data="00"/>
<value name="KeyBarRClick" type="hex" data="01"/>
<value name="StatusBar.Show" type="hex" data="01"/>
<value name="StatusBar.Flags" type="dword" data="00000002"/>
<value name="StatusFontFace" type="string" data="Segoe UI"/>
<value name="StatusFontCharSet" type="dword" data="00000000"/>
<value name="StatusBar.Color.Back" type="dword" data="00423607"/>
<value name="StatusBar.Color.Light" type="dword" data="00e3f6fd"/>
<value name="StatusBar.Color.Dark" type="dword" data="00a1a193"/>
<value name="StatusBar.Hide.VCon" type="hex" data="00"/>
<value name="StatusBar.Hide.CapsL" type="hex" data="01"/>
<value name="StatusBar.Hide.NumL" type="hex" data="00"/>
<value name="StatusBar.Hide.ScrL" type="hex" data="01"/>
<value name="StatusBar.Hide.VisL" type="hex" data="01"/>
<value name="StatusBar.Hide.Lang" type="hex" data="01"/>
<value name="StatusBar.Hide.KeyHooks" type="hex" data="01"/>
<value name="StatusBar.Hide.WPos" type="hex" data="01"/>
<value name="StatusBar.Hide.WSize" type="hex" data="01"/>
<value name="StatusBar.Hide.WClient" type="hex" data="01"/>
<value name="StatusBar.Hide.WWork" type="hex" data="01"/>
<value name="StatusBar.Hide.WVBack" type="hex" data="01"/>
<value name="StatusBar.Hide.WVDC" type="hex" data="01"/>
<value name="StatusBar.Hide.Style" type="hex" data="01"/>
<value name="StatusBar.Hide.StyleEx" type="hex" data="01"/>
<value name="StatusBar.Hide.hFore" type="hex" data="01"/>
<value name="StatusBar.Hide.hFocus" type="hex" data="01"/>
<value name="StatusBar.Hide.Zoom" type="hex" data="01"/>
<value name="StatusBar.Hide.Dpi" type="hex" data="01"/>
<value name="StatusBar.Hide.ABuf" type="hex" data="00"/>
<value name="StatusBar.Hide.CPos" type="hex" data="01"/>
<value name="StatusBar.Hide.CSize" type="hex" data="00"/>
<value name="StatusBar.Hide.BSize" type="hex" data="01"/>
<value name="StatusBar.Hide.CurX" type="hex" data="01"/>
<value name="StatusBar.Hide.CurY" type="hex" data="01"/>
<value name="StatusBar.Hide.CurS" type="hex" data="01"/>
<value name="StatusBar.Hide.CurI" type="hex" data="00"/>
<value name="StatusBar.Hide.ConEmuPID" type="hex" data="01"/>
<value name="StatusBar.Hide.ConEmuHWND" type="hex" data="01"/>
<value name="StatusBar.Hide.ConEmuView" type="hex" data="01"/>
<value name="StatusBar.Hide.Srv" type="hex" data="00"/>
<value name="StatusBar.Hide.SrvHWND" type="hex" data="01"/>
<value name="StatusBar.Hide.Transparency" type="hex" data="00"/>
<value name="StatusBar.Hide.New" type="hex" data="00"/>
<value name="StatusBar.Hide.Sync" type="hex" data="00"/>
<value name="StatusBar.Hide.Proc" type="hex" data="00"/>
<value name="StatusBar.Hide.Title" type="hex" data="01"/>
<value name="StatusBar.Hide.Time" type="hex" data="01"/>
<value name="StatusBar.Hide.Resize" type="hex" data="00"/>
<value name="Tabs" type="hex" data="00"/>
<value name="TabsLocation" type="hex" data="00"/>
<value name="TabIcons" type="hex" data="01"/>
<value name="OneTabPerGroup" type="hex" data="00"/>
<value name="ActivateSplitMouseOver" type="hex" data="01"/>
<value name="TabSelf" type="hex" data="01"/>
<value name="TabLazy" type="hex" data="01"/>
<value name="TabFlashChanged" type="dword" data="00000008"/>
<value name="TabRecent" type="hex" data="01"/>
<value name="TabDblClick" type="dword" data="00000001"/>
<value name="TabBtnDblClick" type="dword" data="00000000"/>
<value name="TabsOnTaskBar" type="hex" data="02"/>
<value name="TaskBarOverlay" type="hex" data="01"/>
<value name="TaskbarProgress" type="hex" data="01"/>
<value name="TabCloseMacro" type="string" data=""/>
<value name="TabFontFace" type="string" data="Segoe UI"/>
<value name="TabFontCharSet" type="dword" data="00000000"/>
<value name="SaveAllEditors" type="string" data=""/>
<value name="ToolbarAddSpace" type="dword" data="00000000"/>
<value name="TabConsole" type="string" data="&lt;%c&gt; %s"/>
<value name="TabModifiedSuffix" type="string" data="[*]"/>
<value name="TabSkipWords" type="string" data="Administrator:|Администратор:"/>
<value name="TabPanels" type="string" data="&lt;%c&gt; %s"/>
<value name="TabEditor" type="string" data="&lt;%c.%i&gt;{%s}"/>
<value name="TabEditorModified" type="string" data="&lt;%c.%i&gt;[%s] *"/>
<value name="TabViewer" type="string" data="&lt;%c.%i&gt;[%s]"/>
<value name="TabLenMax" type="dword" data="00000014"/>
<value name="AdminTitleSuffix" type="string" data=" (Admin)"/>
<value name="AdminShowShield" type="hex" data="01"/>
<value name="HideInactiveConsoleTabs" type="hex" data="00"/>
<value name="ShowFarWindows" type="hex" data="01"/>
<value name="TryToCenter" type="hex" data="01"/>
<value name="CenterConsolePad" type="dword" data="00000000"/>
<value name="ShowScrollbar" type="hex" data="00"/>
<value name="ScrollBarAppearDelay" type="dword" data="00000064"/>
<value name="ScrollBarDisappearDelay" type="dword" data="000001f4"/>
<value name="IconID" type="dword" data="00000001"/>
<value name="MainTimerElapse" type="dword" data="0000000a"/>
<value name="MainTimerInactiveElapse" type="dword" data="000003e8"/>
<value name="AffinityMask" type="dword" data="00000000"/>
<value name="SkipFocusEvents" type="hex" data="00"/>
<value name="MonitorConsoleLang" type="hex" data="03"/>
<value name="SnapToDesktopEdges" type="hex" data="00"/>
<value name="AlwaysOnTop" type="hex" data="00"/>
<value name="SleepInBackground" type="hex" data="00"/>
<value name="RetardInactivePanes" type="hex" data="00"/>
<value name="MinimizeOnLoseFocus" type="hex" data="00"/>
<value name="DisableFarFlashing" type="hex" data="00"/>
<value name="DisableAllFlashing" type="hex" data="00"/>
<value name="FindText" type="string" data=""/>
<value name="FindMatchCase" type="hex" data="00"/>
<value name="FindMatchWholeWords" type="hex" data="00"/>
<value name="FindTransparent" type="hex" data="01"/>
<value name="PanView.BackColor" type="dword" data="30ffffff"/>
<value name="PanView.PFrame" type="dword" data="00000001"/>
<value name="PanView.PFrameColor" type="dword" data="28808080"/>
<value name="PanView.SFrame" type="dword" data="00000001"/>
<value name="PanView.SFrameColor" type="dword" data="07c0c0c0"/>
<value name="PanView.Thumbs.ImgSize" type="dword" data="00000060"/>
<value name="PanView.Thumbs.SpaceX1" type="dword" data="00000001"/>
<value name="PanView.Thumbs.SpaceY1" type="dword" data="00000001"/>
<value name="PanView.Thumbs.SpaceX2" type="dword" data="00000005"/>
<value name="PanView.Thumbs.SpaceY2" type="dword" data="00000014"/>
<value name="PanView.Thumbs.LabelSpacing" type="dword" data="00000002"/>
<value name="PanView.Thumbs.LabelPadding" type="dword" data="00000000"/>
<value name="PanView.Thumbs.FontName" type="string" data="Segoe UI"/>
<value name="PanView.Thumbs.FontHeight" type="dword" data="0000000e"/>
<value name="PanView.Tiles.ImgSize" type="dword" data="00000030"/>
<value name="PanView.Tiles.SpaceX1" type="dword" data="00000004"/>
<value name="PanView.Tiles.SpaceY1" type="dword" data="00000004"/>
<value name="PanView.Tiles.SpaceX2" type="dword" data="000000ac"/>
<value name="PanView.Tiles.SpaceY2" type="dword" data="00000004"/>
<value name="PanView.Tiles.LabelSpacing" type="dword" data="00000004"/>
<value name="PanView.Tiles.LabelPadding" type="dword" data="00000001"/>
<value name="PanView.Tiles.FontName" type="string" data="Segoe UI"/>
<value name="PanView.Tiles.FontHeight" type="dword" data="0000000e"/>
<value name="PanView.LoadPreviews" type="hex" data="03"/>
<value name="PanView.LoadFolders" type="hex" data="01"/>
<value name="PanView.LoadTimeout" type="dword" data="0000000f"/>
<value name="PanView.MaxZoom" type="dword" data="00000258"/>
<value name="PanView.UsePicView2" type="hex" data="01"/>
<value name="PanView.RestoreOnStartup" type="hex" data="00"/>
<value name="Update.VerLocation" type="string" data=""/>
<value name="Update.InetTool" type="hex" data="00"/>
<value name="Update.InetToolCmd" type="string" data=""/>
<value name="Update.UseProxy" type="hex" data="00"/>
<value name="Update.Proxy" type="string" data=""/>
<value name="Update.ProxyUser" type="string" data=""/>
<value name="Update.ProxyPassword" type="string" data=""/>
<value name="Update.ExeCmdLine" type="string" data=""/>
<value name="Update.ArcCmdLine" type="string" data=""/>
<value name="Update.DownloadPath" type="string" data="%TEMP%\ConEmu"/>
<value name="Update.LeavePackages" type="hex" data="00"/>
<value name="Update.PostUpdateCmd" type="string" data="echo Last successful update&gt;ConEmuUpdate.info &amp;&amp; date /t&gt;&gt;ConEmuUpdate.info &amp;&amp; time /t&gt;&gt;ConEmuUpdate.info"/>
<key name="Tasks" modified="2016-02-08 00:02:27" build="150813f">
<value name="Count" type="dword" data="00000008"/>
<key name="Task1" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Shells::cmd}"/>
<value name="Flags" type="dword" data="00000002"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="cmd.exe /k &quot;%ConEmuBaseDir%\CmdInit.cmd&quot;"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task2" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Shells::cmd (Admin)}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="cmd.exe /k &quot;%ConEmuBaseDir%\CmdInit.cmd&quot; -new_console:a"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task3" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Shells::cmd-32}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="&quot;%windir%\syswow64\cmd.exe&quot; /k &quot;%ConEmuBaseDir%\CmdInit.cmd&quot;"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task4" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Shells::cmd 64/32}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="&gt; &quot;%windir%\system32\cmd.exe&quot; /k &quot;&quot;%ConEmuBaseDir%\CmdInit.cmd&quot; &amp; echo This is Native cmd.exe&quot;"/>
<value name="Cmd2" type="string" data="&quot;%windir%\syswow64\cmd.exe&quot; /k &quot;&quot;%ConEmuBaseDir%\CmdInit.cmd&quot; &amp; echo This is 32 bit cmd.exe -new_console:s50V&quot;"/>
<value name="Active" type="dword" data="00000001"/>
<value name="Count" type="dword" data="00000002"/>
</key>
<key name="Task5" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Shells::PowerShell}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="powershell.exe"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task6" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Shells::PowerShell (Admin)}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="powershell.exe -new_console:a"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task7" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Tests::Show ANSI colors}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="cmd.exe /k type &quot;%ConEmuBaseDir%\Addons\AnsiColors16t.ans&quot; -cur_console:n"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
<key name="Task8" modified="2016-02-08 00:02:27" build="150813f">
<value name="Name" type="string" data="{Scripts::Chocolatey (Admin)}"/>
<value name="Flags" type="dword" data="00000000"/>
<value name="Hotkey" type="dword" data="00000000"/>
<value name="GuiArgs" type="string" data=""/>
<value name="Cmd1" type="string" data="*cmd.exe /k Title Chocolatey &amp; &quot;%ConEmuBaseDir%\Addons\ChocolateyAbout.cmd&quot;"/>
<value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/>
</key>
</key>
<key name="Apps" modified="2016-02-08 00:02:27" build="150813f">
<value name="Count" type="dword" data="00000000"/>
</key>
<key name="Colors" modified="2016-02-08 00:02:27" build="150813f">
<value name="Count" type="dword" data="00000000"/>
</key>
</key>
</key>
</key>

View file

@ -68,7 +68,7 @@
<Setting name="ViewModeGlobal">4</Setting> <Setting name="ViewModeGlobal">4</Setting>
</Settings> </Settings>
<WindowPosition> <WindowPosition>
<Setting name="Position" Flags="2" ShowCmd="3" MinPositionX="0" MinPositionY="0" MaxPositionX="-1" MaxPositionY="-1" NormalPositionLeft="32" NormalPositionTop="45" NormalPositionRight="1568" NormalPositionBottom="783"/> <Setting name="Position" Flags="2" ShowCmd="3" MinPositionX="0" MinPositionY="4" MaxPositionX="-1" MaxPositionY="-1" NormalPositionLeft="1023" NormalPositionTop="8" NormalPositionRight="1159" NormalPositionBottom="72"/>
</WindowPosition> </WindowPosition>
<Tabs> <Tabs>
<Tab name="0" Directory="C:\" ApplyFilter="no" AutoArrange="yes" Filter="" FilterCaseSensitive="no" ShowGridlines="yes" ShowHidden="yes" ShowInGroups="no" SortAscending="yes" SortMode="1" ViewMode="4" Locked="no" AddressLocked="no" UseCustomName="no" CustomName=""> <Tab name="0" Directory="C:\" ApplyFilter="no" AutoArrange="yes" Filter="" FilterCaseSensitive="no" ShowGridlines="yes" ShowHidden="yes" ShowInGroups="no" SortAscending="yes" SortMode="1" ViewMode="4" Locked="no" AddressLocked="no" UseCustomName="no" CustomName="">
@ -108,5 +108,6 @@
<ColorRule name="Encrypted files" FilenamePattern="" Attributes="16384" r="0" g="128" b="0"/> <ColorRule name="Encrypted files" FilenamePattern="" Attributes="16384" r="0" g="128" b="0"/>
</ColorRules> </ColorRules>
<State> <State>
<DialogState name="MassRename" PosX="717" PosY="376" Width="501" Height="294" ColumnWidth1="250" ColumnWidth2="250"/>
</State> </State>
</ExplorerPlusPlus> </ExplorerPlusPlus>

View file

@ -1,165 +0,0 @@
[main]
bufsize="128"
max_transize="16"
nonbuf_minsize_ntfs2="64"
nonbuf_minsize_fat="128"
is_readosbuf="0"
max_history="10"
default_copy_mode="1"
skip_empty_dir="1"
ignore_error="1"
estimate_mode="0"
disk_mode="0"
is_toplevel="0"
is_errlog="1"
is_utf8log="1"
filelog_mode="0"
aclerr_log="0"
streamerr_log="0"
is_samedir_rename="1"
shext_autoclose="1"
shext_tasktray="0"
shext_dd_noconfirm="0"
shext_right_noconfirm="0"
exec_confirm="0"
force_start="0"
lcid="-1"
speed_level="11"
overwrite_del="0"
acl="0"
stream="0"
verify="0"
nsa_del="0"
deldir_with_filter="0"
move_attr="0"
serial_move="0"
serial_verify_move="0"
reparse2="1"
extend_filter="0"
taskbarMode="0"
infoSpan="2"
win_pos="-10000,-10000,-10000,-10000"
driveMap=""
[src_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[dst_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[del_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[include_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[exclude_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[fromdate_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[todate_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[minsize_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[maxsize_history]
0=""
1=""
2=""
3=""
4=""
5=""
6=""
7=""
8=""
9=""
[finaction_0]
title="Normal"
sound=""
cmd=""
shutdown_time="-1"
flags="1"
[finaction_1]
title="Standby"
sound=""
cmd=""
shutdown_time="60"
flags="65"
[finaction_2]
title="Hibernate"
sound=""
cmd=""
shutdown_time="60"
flags="129"
[finaction_3]
title="Shutdown"
sound=""
cmd=""
shutdown_time="60"
flags="257"

View file

@ -4,571 +4,100 @@
$wd = $(Split-Path $MyInvocation.MyCommand.Path) $wd = $(Split-Path $MyInvocation.MyCommand.Path)
pushd "$wd" pushd "$wd"
. .\init.ps1 . .\init.ps1
. .\servers.ps1
. .\imaging.ps1
clear clear
$host.UI.RawUI.WindowTitle = "WK PE Tool" $host.UI.RawUI.WindowTitle = "WK PE Tool"
$logpath = "$WKPath\Info\$date" $logpath = "$WKPath\Info\$date"
md "$logpath" 2>&1 | Out-Null md "$logpath" 2>&1 | Out-Null
$log = "$logpath\winpe.log" $log = "$logpath\winpe.log"
$source_server = "10.0.0.10"
$backup_servers = @(
@{ "ip"="10.0.0.10";
"letter"="Z";
"name"="ServerOne";
"path"="Backups"},
@{ "ip"="10.0.0.11";
"name"="ServerTwo";
"letter"="Y";
"path"="Backups"}
)
$backup_user = "backup"
$backup_pass = "Abracadabra"
# Functions # Functions
function apply-image {
Param([string]$image, [int]$index)
$path = ""
$split_image = $false
$split_image_pattern = ""
# Check for local source
$volumes = Get-Volume | Where-Object {$_.Size -ne 0 -and $_.DriveLetter -match '^[C-Z]$'}
foreach ($v in $volumes) {
$letter = $v.DriveLetter + ":"
if (Test-Path "$letter\sources\$image.wim") {
$path = "$letter\sources\$image.wim"
} elseif (Test-Path "$letter\sources\$image.swm") {
$path = "$letter\sources\$image.swm"
$split_image = $true
$split_image_pattern = "$letter\sources\$image*.swm"
}
}
# Check for remote source (if necessary)
if ($path -match '^$') {
net use z: "\\$source_server\Windows" /user:guest notarealpassword
if (Test-Path "Z:\$image.wim") {
$path = "Z:\$image.wim"
} elseif (Test-Path "Z:\$image.swm") {
$path = "Z:\$image.swm"
}
}
# Expand Image
if ($path -match '\.wim$') {
Expand-WindowsImage -ImagePath "$path" -Index $index -ApplyPath 'W:\'
} elseif ($path -match '\.swm$') {
Expand-WindowsImage -ImagePath "$path" -Index $index -ApplyPath 'W:\' -SplitImageFilePattern "$split_image_pattern"
} else {
net use z: /delete
throw "Source image not found."
}
net use z: /delete
}
function format-gpt {
Param($dest_disk)
wk-write "Drive will use a GPT (UEFI) layout."
# Double-check we have the right drive
## I don't trust the order will be the same for diskpart & PS Storage Cmdlets
$_sel_uid = $dest_disk.Guid
if ($dest_disk.PartitionStyle -imatch "MBR") {
# MBR disks don't have GUIDs and use the signature in hex instead
$_sel_uid = "{0:x}" -f $dest_disk.Signature
}
$diskpart_script = "select disk {0}`r`n" -f $dest_disk.DiskNumber
$diskpart_script += "uniqueid disk"
Out-File -encoding 'UTF8' -filepath "$wd\diskpart.script" -inputobject $diskpart_script
Start-Process "diskpart" -argumentlist @("/s", "$wd\diskpart.script") -wait -nonewwindow -PassThru -RedirectStandardOutput "$wd\drive_uid" | Out-Null
if (!(Get-Content "$wd\drive_uid" | Where-Object {$_ -imatch $_sel_uid})) {
# GUIDs do not match
wk-error "Diskpart failed to select the same disk for formatting, aborting setup."
wk-warn "This system requires manual formatting & setup"
wk-write ""
throw "Failed to format disk"
} else {
wk-write ("Selecting Disk {0} ({1})" -f $dest_disk.DiskNumber, $_sel_uid)
}
# Generate Diskpart script and execute
## NOTE 1: PS Storage Cmdlets can't be used; See Keith Garner's response here:
## https://social.technet.microsoft.com/Forums/en-US/9d78da31-557f-4408-89e0-a1603f7ebe0d
##
## NOTE 2: This overwrites existing diskpart.script file without confirmation.
$diskpart_script = "select disk {0}`r`n" -f $dest_disk.DiskNumber
$diskpart_script += "clean`r`n"
$diskpart_script += "convert gpt`r`n"
# 1. Windows RE tools partition (Windows 8+)
if ($dest_windows_version.Name -match '^Windows (8|10)') {
$diskpart_script += "create partition primary size=300`r`n"
$diskpart_script += "format quick fs=ntfs label='Windows RE tools'`r`n"
$diskpart_script += "assign letter='T'`r`n"
$diskpart_script += "set id='de94bba4-06d1-4d40-a16a-bfd50179d6ac'`r`n"
$diskpart_script += "gpt attributes=0x8000000000000001`r`n"
}
# 2. System partition
$diskpart_script += "create partition efi size=260`r`n"
## NOTE: Allows for Advanced Format 4Kn drives
$diskpart_script += "format quick fs=fat32 label='System'`r`n"
$diskpart_script += "assign letter='S'`r`n"
# 3. Microsoft Reserved (MSR) partition
$diskpart_script += "create partition msr size=128`r`n"
# 4. Windows partition
$diskpart_script += "create partition primary`r`n"
$diskpart_script += "format quick fs=ntfs label='Windows'`r`n"
$diskpart_script += "assign letter='W'`r`n"
# Run script
Out-File -encoding 'UTF8' -filepath "$wd\diskpart.script" -inputobject $diskpart_script
Start-Process "diskpart" -argumentlist @("/s", "$wd\diskpart.script") -wait -nonewwindow
}
function format-mbr {
Param($dest_disk)
wk-write "Drive will use a MBR (legacy) layout."
if ($dest_disk.PartitionStyle -notmatch '^RAW$') {
# Only clean if necessary
Clear-Disk $dest_disk.DiskNumber -RemoveData -RemoveOEM -Confirm:$false
}
Initialize-Disk $dest_disk.DiskNumber -PartitionStyle 'MBR'
New-Partition -DiskNumber $dest_disk.DiskNumber -Size 100Mb -DriveLetter 'S' -IsActive:$true
New-Partition -DiskNumber $dest_disk.DiskNumber -UseMaximumSize -DriveLetter 'W' -IsActive:$false
Format-Volume -DriveLetter 'S' -FileSystem 'NTFS' -NewFileSystemLabel 'System Reserved'
Format-Volume -DriveLetter 'W' -FileSystem 'NTFS' -NewFileSystemLabel 'Windows'
}
function select-disk {
$_skipped_parts = 0
# Check if any source drives were detected
$disks = Get-Disk | Where-Object {$_.Size -ne 0} | Sort-Object -Property "Number"
if ($disks.count -eq 0) {
wk-error "No suitable source drives were detected."
return $false
} elseif ($disks.count -eq $null) {
# Assuming only one disk is available
$answer = $disks.DiskNumber
} else {
# Build source menu
$menu_imaging_source = "For which drive are we creating backup image(s)?`r`n`r`n"
$valid_answers = @("M", "m")
foreach ($_ in $disks) {
$valid_answers += $_.DiskNumber
$menu_imaging_source += "{0}: {1,4:N0} Gb`t[{2}] ({3}) {4}`r`n" -f $_.DiskNumber, ($_.Size / 1GB), $_.PartitionStyle, $_.BusType, $_.FriendlyName
}
$menu_imaging_source += "`r`n"
$menu_imaging_source += "M: Main Menu`r`n"
$menu_imaging_source += "`r`n"
$menu_imaging_source += "Please make a selection`r`n"
# Select source
do {
clear
$answer = read-host -prompt $menu_imaging_source
} until ($valid_answers -contains $answer)
}
if ($answer -imatch '^\d+$') {
# Valid disk selected
clear
$_d = Get-Disk -number $answer
$_disk_details = "Disk:`t{0,4:N0} Gb`t[{1}] ({2}) {3}" -f ($_d.Size / 1GB), $_d.PartitionStyle, $_d.BusType, $_d.FriendlyName
wk-write "$_disk_details"
wk-write "Partition(s):"
# Print partition info
$partitions = Get-Partition -DiskNumber $_d.DiskNumber
foreach ($_p in $partitions) {
# Assign letter
Add-PartitionAccessPath -DiskNumber $_d.DiskNumber -PartitionNumber $_p.PartitionNumber -AssignDriveLetter 2>&1 | Out-Null
# Update partition info
$_p = Get-Partition -DiskNumber $_d.DiskNumber -PartitionNumber $_p.PartitionNumber
$_v = Get-Volume -Partition $_p
# Set size label
$_size = (human-size $_p.size 0)
if ($_v -ne $null) {
$_used = (human-size ($_v.Size - $_v.SizeRemaining) 0)
}
# Print partition info
if ($_p.AccessPaths -eq $null) {
# No drive letter
$_msg = " *{0:N0}:`t ({1}) {2}" -f $_p.PartitionNumber, $_size, $_p.Type
wk-error "$_msg"
$_skipped_parts += 1
} else {
# Has drive letter
$_path = $_p.AccessPaths | Where-Object {$_ -imatch '^\w:\\$'}
$_label = " {0}" -f $_p.Type
if ($_v -and $_v.FileSystemLabel -ne "") {
$_label = '"{0}"' -f $_v.FileSystemLabel
}
$_msg = " {0:N0}:`t{1} ({2,6}) {3} ({4} used)" -f $_p.PartitionNumber, $_path, $_size, $_label, $_used
wk-write "$_msg"
}
}
if ($_skipped_parts -gt 0) {
wk-warn " *`tUnable to backup these partition(s)"
}
wk-write ""
if (ask " Backup these partition(s)?") {
return $_d
} else {
return $false
}
}
return $answer
}
function select-server {
# Build server menu
$avail_servers = @(gdr | Where-Object {$_.DisplayRoot -imatch '\\\\'})
if ($avail_servers.count -eq 0) {
wk-error "No suitable backup servers were detected."
return $false
}
$menu_imaging_server = "Where are we saving the backup image(s)?`r`n`r`n"
$valid_answers = @("M", "m")
for ($i=0; $i -lt $avail_servers.length; $i++) {
$valid_answers += ($i + 1)
$menu_imaging_server += ("{0}: {1} ({2:N2} Gb free)`r`n" -f ($i + 1), $avail_servers[$i].Description, ($avail_servers[$i].Free / 1Gb))
}
$menu_imaging_server += "`r`n"
$menu_imaging_server += "M: Main Menu`r`n"
$menu_imaging_server += "`r`n"
$menu_imaging_server += "Please make a selection`r`n"
# Select server
do {
# clear
$answer = read-host -prompt $menu_imaging_server
} until ($valid_answers -contains $answer)
if ($answer -imatch '^\d+$') {
$answer -= 1
return $avail_servers[$answer]
}
return $answer
}
function wk-exit { function wk-exit {
popd param([string]$action)
if ($answer -match 'R') { switch ($action) {
#pause "Press Enter to Reboot... " 'Q' {PowerShell -ExecutionPolicy Bypass; break}
wpeutil reboot 'R' {wpeutil reboot; break}
} elseif ($answer -match 'S') { 'S' {wpeutil shutdown; break}
#pause "Press Enter to Shutdown... " default {throw}
wpeutil shutdown
} }
exit 0 exit 0
} }
function mount-servers {
# Mount servers
wk-write "Connecting to backup server(s)"
foreach ($_server in $backup_servers) {
if (test-connection $_server.ip -count 3 -quiet) {
try {
$_path = "\\{0}\{1}" -f $_server.ip, $_server.path
$_drive = "{0}:" -f $_server.letter
net use $_drive "$_path" /user:$backup_user $backup_pass | Out-Null
wk-write ("`t{0} server: mounted" -f $_server.name)
# Add friendly description
$_regex = "^{0}$" -f $_server.letter
(gdr | Where-Object {$_.Name -imatch $_regex}).Description = $_server.name
} catch {
wk-warn ("`t{0} server: failed" -f $_server.name)
}
} else {
wk-warn ("`t{0} server: timed-out" -f $_server.name)
}
}
}
function unmount-servers {
# Unmount servers
wk-write "Disconnecting from backup server(s)"
$mounted_servers = @(gdr | Where-Object {$_.DisplayRoot -imatch '\\\\'})
foreach ($_server in $mounted_servers) {
try {
$_drive = "{0}:" -f $_server.Name
net use $_drive /delete | Out-Null
#wk-warn ("`t{0} server: unmounted" -f $_server.name)
wk-warn "`tServer: unmounted"
} catch {
#wk-warn ("`t{0} server: failed" -f $_server.name)
wk-warn "`tServer: failed"
}
}
}
function menu-imaging {
wk-write "Drive Imaging"
wk-write ""
## WARNING
wk-warn "WARNING: This section is experimental"
pause
## WARNING
# Service Order
$menu_service_order += "Please enter the service order`r`n"
do {
clear
$service_order = read-host -prompt $menu_service_order
} until ($service_order -imatch '^\d[\w\-]+$')
# Select Disk
$disk = select-disk
if (!($disk)) {
# No drives detected or user aborted
wk-warn "Drive Imaging aborted."
wk-write ""
pause "Press Enter to return to main menu... "
return $false
} elseif ($disk -imatch '^M$') {
# User selected to return to the menu
return
}
wk-write ""
# Mount server(s)
mount-servers
# Select Server
$server = select-server
if (!($server)) {
# No servers detected
wk-warn "Drive Imaging aborted."
wk-write ""
pause "Press Enter to return to main menu... "
return $false
} elseif ($server -imatch '^M$') {
# User selected to return to the menu
return
}
wk-write ""
wk-write ("Saving partition backups to: {0}" -f $server.Description)
wk-write ""
# Backup partitions
$partitions = Get-Partition -DiskNumber $disk.DiskNumber
foreach ($_p in $partitions) {
$_v = Get-Volume -Partition $_p
$_name = "{0}" -f $_p.PartitionNumber
if ($_v -and $_v.FileSystemLabel -ne "") {
$_name += "_{0}" -f $_v.FileSystemLabel
} else {
$_name += "_{0}" -f $_p.Type
}
$_imagepath = "{0}{1}" -f $server.Root, $service_order
$_imagefile = "{0}{1}\{2}.wim" -f $server.Root, $service_order, $_name
if ($_p.AccessPaths -ne $null) {
$_capturepath = $_p.AccessPaths | Where-Object {$_ -imatch '^\w:\\$'}
# Take image
wk-write (" Imaging partition {0} --> `"{1}`"" -f $_p.PartitionNumber, $_imagefile)
if (!(Test-Path "$_imagepath")) {
mkdir "$_imagepath" | out-null
}
New-WindowsImage -ImagePath "$_imagefile" -CapturePath "$_capturepath" -Name "$_name" -CompressionType "fast" | out-null
# Verify image
## Code borrowed from: https://stackoverflow/a/10262275
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "$WKPath\7z.exe"
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = 't "{0}"' -f $_imagefile
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
write-host " Verifying . . . " -NoNewline
$p.WaitForExit()
if ($p.ExitCode -eq 0) {
write-host "Complete." -foreground "green"
} else {
write-host "Failed." -foreground "red"
}
}
}
# Unmount server(s)
unmount-servers
pause "Press Enter to return to main menu... "
}
function menu-setup {
wk-write "Windows Setup"
wk-write ""
# Check if any destination drives were detected
$disks = Get-Disk | Where-Object {$_.Size -ne 0 -and $_.BusType -inotmatch 'USB'}
if ($disks.count -eq 0) {
wk-error "No suitable destination drives were detected."
pause "Press Enter to return to main menu... " $True
return $false
}
# Build windows menu
$windows_versions = @(
@{Name="Windows 7 Home Premium"; ImageFile="Win7"; Index=1},
@{Name="Windows 7 Professional"; ImageFile="Win7"; Index=2},
@{Name="Windows 7 Ultimate"; ImageFile="Win7"; Index=3},
@{Name="Windows 8.1"; ImageFile="Win8"; Index=1},
@{Name="Windows 8.1 Pro"; ImageFile="Win8"; Index=2},
@{Name="Windows 10 Home"; ImageFile="Win10"; Index=1},
@{Name="Windows 10 Pro"; ImageFile="Win10"; Index=2}
)
$menu_setup_windows = "Which version of Windows are we installing?`r`n`r`n"
$valid_answers = @("M", "m")
for ($i=0; $i -lt $windows_versions.length; $i++) {
$valid_answers += ($i + 1)
$menu_setup_windows += "{0}: {1}`r`n" -f ($i + 1), $windows_versions[$i].Name
}
$menu_setup_windows += "`r`n"
$menu_setup_windows += "M: Main Menu`r`n"
$menu_setup_windows += "`r`n"
$menu_setup_windows += "Please make a selection`r`n"
# Select Windows version
do {
clear
$answer = read-host -prompt $menu_setup_windows
} until ($valid_answers -contains $answer)
if ($answer -imatch '^M$') {
# Exit if requested
return
} else {
$answer -= 1
$dest_windows_version = $windows_versions[$answer]
}
# Build disk menu
$menu_setup_disk = "To which drive are we installing {0}?`r`n`r`n" -f $dest_windows_version.Name
$valid_answers = @("M", "m")
foreach ($_ in $disks) {
$valid_answers += $_.DiskNumber
$menu_setup_disk += "{0}: {1:N0} Gb`t({2}) {3}`r`n" -f $_.DiskNumber, ($_.Size / 1GB), $_.PartitionStyle, $_.FriendlyName
}
$menu_setup_disk += "`r`n"
$menu_setup_disk += "M: Main Menu`r`n"
$menu_setup_disk += "`r`n"
$menu_setup_disk += "Please make a selection`r`n"
# Select disk
do {
clear
$answer = read-host -prompt $menu_setup_disk
} until ($valid_answers -contains $answer)
if ($answer -imatch '^M$') {
# Exit if requested
return
} else {
# Double check before deleting data
$dest_disk = $disks | Where-Object {$_.DiskNumber -eq $answer}
wk-warn "All data will be deleted from the following drive:"
wk-warn ("`t{0:N0} Gb`t({1}) {2}`r`n" -f ($dest_disk.Size / 1GB), $dest_disk.PartitionStyle, $dest_disk.FriendlyName)
if (ask ("Proceed and install {0}?" -f $dest_windows_version.Name)) {
wk-warn "SAFTEY CHECK:"
wk-write (" Installing:`t{0}" -f $dest_windows_version.Name)
wk-error (" And ERASING:`tDisk {0} - {1:N0} Gb`t({2}) {3}`r`n" -f $dest_disk.DiskNumber, ($dest_disk.Size / 1GB), $dest_disk.PartitionStyle, $dest_disk.FriendlyName)
if (ask "Is this correct?") {
## WARNING
wk-warn "WARNING: This section is experimental"
## WARNING
## Here be dragons
try {
# Select UEFI or BIOS
if ($dest_windows_version.Name -match '^Windows 7') {
if (ask "Setup drive using MBR (legacy) layout?") {
format-mbr $dest_disk
} else {
format-gpt $dest_disk
}
} elseif ($dest_windows_version.Name -match '^Windows (8|10)') {
if (ask "Setup drive using GPT (UEFI) layout?") {
format-gpt $dest_disk
} else {
format-mbr $dest_disk
}
}
# Apply image
apply-image $dest_windows_version.ImageFile $dest_windows_version.Index
# Create boot files (copies files for both Legacy and UEFI)
bcdboot W:\Windows /s S: /f ALL
if ($dest_windows_version.Name -match '^Windows (8|10)') {
W:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target W:\Windows
}
# Reboot
wk-write "Windows Setup complete."
wk-write ""
return 0
} catch {
wk-error "$Error"
wk-error "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... "
return $false
}
} else {
wk-error "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... "
}
} else {
wk-error "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... "
}
}
}
function menu-tools { function menu-tools {
wk-write "Misc Tools" # Avail tools
wk-write "" $tools = @(
wk-warn "Be careful." @{Name="Blue Screen View"; Folder="BlueScreenView"; File="BlueScreenView64.exe"},
Start-Process "$WKPath\explorer++" -argumentlist @("$WKPath") @{Name="Explorer++"; Folder="Explorer++"; File="Explorer++64.exe"},
wk-exit @{Name="Fast Copy"; Folder="FastCopy"; File="FastCopy64.exe"; Args=@('/cmd=noexist_only', '/utf8', '/skip_empty_dir', '/linkdest', '/exclude="desktop.ini;Thumbs.db"')},
@{Name="HW Monitor"; Folder="HWMonitor"; File="HWMonitor64.exe"},
@{Name="NT Password Editor"; Folder="NT Password Editor"; File="ntpwedit64.exe"},
@{Name="Notepad2"; Folder="Notepad2"; File="Notepad2-Mod64.exe"},
@{Name="Prime95"; Folder="Prime95"; File="prime95.exe"},
@{Name="PhotoRec (GUI)"; Folder="TestDisk"; File="qphotorec_win.exe"},
@{Name="PhotoRec (CLI)"; Folder="TestDisk"; File="photorec_win.exe"},
@{Name="TestDisk (CLI)"; Folder="TestDisk"; File="testdisk_win.exe"}
)
# Build menu
$selection = $null
$actions = @(@{Name="Main Menu"; Letter="M"})
# Run Loop
$_done = $false
do {
$selection = (menu-select "Tools Menu" $tools $actions)
if ($selection -imatch '^M$') {
# User selected to return to the menu
return $false
} elseif ($selection -inotmatch '^\d+$') {
# This shouldn't happen?
throw
} else {
$selection -= 1
$path = "{0}\{1}" -f $WKPath, $tools[$selection].Folder
if ($tools[$selection].ContainsKey("Args")) {
Start-Process $tools[$selection].File -ArgumentList $tools[$selection].Args -WorkingDirectory $path
} else {
Start-Process $tools[$selection].File -WorkingDirectory $path
}
}
} until ($_done)
} }
function menu-main { function menu-main {
$answered = $false # Build menu
$menu_main = @" $selection = $null
WK WinPE Tools $menus = @(
@{Name="Drive Imaging"; Menu="menu-imaging"}
1: Drive Imaging @{Name="Windows Setup"; Menu="menu-setup"}
2: Windows Setup @{Name="Misc Tools"; Menu="menu-tools"}
3: Misc Tools )
$actions = @(
Q: Quit @{Name="Command Prompt"; Letter="C"}
R: Reboot @{Name="PowerShell"; Letter="P"}
S: Shutdown @{Name="Reboot"; Letter="R"}
@{Name="Shutdown"; Letter="S"}
Please make a selection )
"@
# Show Menu
do { $selection = (menu-select "Main Menu" $menus $actions -SecretExit $true)
clear
$answer = read-host -prompt $menu_main if ($selection -imatch '^C$') {
} until ($answer -imatch '^[123QRS]$') Start-Process "$windir\System32\cmd.exe" -argumentlist @("-new_console:n") -WorkingDirectory "$WKPath"
clear return
} elseif ($selection -imatch '^P$') {
if ($answer.GetType().Name -match "String") { Start-Process "$windir\System32\WindowsPowerShell\v1.0\powershell.exe" -argumentlist @("-ExecutionPolicy", "Bypass", "-new_console:n") -WorkingDirectory "$WKPath"
$answer = $answer.ToUpper() return
} } elseif ($selection -imatch '^[QRS]$') {
switch ($answer) { wk-exit $selection
1 {menu-imaging; break} return
2 {menu-setup; break} } elseif ($selection -inotmatch '^\d+$') {
3 {menu-tools; break} # This shouldn't happen?
default {wk-exit} throw
} else {
# Launch sub-menu
$selection -= 1
& $menus[$selection].Menu
} }
} }

463
WK/Scripts/imaging.ps1 Normal file
View file

@ -0,0 +1,463 @@
# WK imaging functions
## Init ##
$wd = $(Split-Path $MyInvocation.MyCommand.Path)
pushd "$wd"
. .\init.ps1
# Functions
function apply-image {
# Apply a Windows image to W:\
Param([string]$image, [string]$name)
$path = ""
$split_image = $false
$split_image_pattern = ""
# Check for local source
$volumes = @(Get-Volume | Where-Object {$_.Size -ne 0 -and $_.DriveLetter -imatch '^[C-Z]$'})
foreach ($v in $volumes) {
$letter = $v.DriveLetter + ":"
if (Test-Path "$letter\sources\$image.wim") {
$path = "$letter\sources\$image.wim"
} elseif (Test-Path "$letter\sources\$image.esd") {
$path = "$letter\sources\$image.wim"
} elseif (Test-Path "$letter\sources\$image.swm") {
$path = "$letter\sources\$image.swm"
$split_image = $true
$split_image_pattern = "$letter\sources\$image*.swm"
}
}
# Check for remote source (if necessary)
if ($path -imatch '^$') {
# Temporarily set path to network source
$path = "\\$source_server\Windows\$image"
wk-warn "Searching for network source"
if (Test-Path "$path.wim") {
$path = "$path.wim"
} elseif (Test-Path "$path.esd") {
$path = "$path.swm"
} elseif (Test-Path "$path.swm") {
$path = "$path.swm"
$split_image = $true
$split_image_pattern = "$path*.swm"
} else {
# Revert to empty path if nothing found.
$path = ""
}
}
# Expand Image
if ($path -imatch 'Win\d+\.(esd|wim)$') {
wk-write " Applying image..."
Expand-WindowsImage -ImagePath "$path" -Name "$name" -ApplyPath 'W:\' | out-null
} elseif ($path -imatch 'Win\d+\.swm$') {
wk-write " Applying split-image..."
Expand-WindowsImage -ImagePath "$path" -Name "$name" -ApplyPath 'W:\' -SplitImageFilePattern "$split_image_pattern" | out-null
} else {
wk-error "Image not found."
throw
}
}
function format-gpt {
Param($dest_disk)
wk-write "Drive will use a GPT (UEFI) layout."
# Double-check we have the right drive
## I don't trust the order will be the same for diskpart & PS Storage Cmdlets
$_sel_uid = $dest_disk.Guid
if ($dest_disk.PartitionStyle -imatch "MBR") {
# MBR disks don't have GUIDs and use the signature in hex instead
$_sel_uid = "{0:x}" -f $dest_disk.Signature
}
$diskpart_script = "select disk {0}`r`n" -f $dest_disk.DiskNumber
$diskpart_script += "uniqueid disk"
Out-File -encoding 'UTF8' -filepath "$wd\diskpart.script" -inputobject $diskpart_script
Start-Process "diskpart" -argumentlist @("/s", "$wd\diskpart.script") -wait -nonewwindow -PassThru -RedirectStandardOutput "$wd\drive_uid" | Out-Null
if (!(Get-Content "$wd\drive_uid" | Where-Object {$_ -imatch $_sel_uid})) {
# GUIDs do not match
wk-error "Diskpart failed to select the same disk for formatting, aborting setup."
wk-warn "This system requires manual formatting & setup"
wk-write ""
throw "Failed to format disk"
} else {
wk-write ("Selecting Disk {0} ({1})" -f $dest_disk.DiskNumber, $_sel_uid)
}
# Generate Diskpart script and execute
## NOTE 1: PS Storage Cmdlets can't be used; See Keith Garner's response here:
## https://social.technet.microsoft.com/Forums/en-US/9d78da31-557f-4408-89e0-a1603f7ebe0d
##
## NOTE 2: This overwrites existing diskpart.script file without confirmation.
$diskpart_script = "select disk {0}`r`n" -f $dest_disk.DiskNumber
$diskpart_script += "clean`r`n"
$diskpart_script += "convert gpt`r`n"
# 1. Windows RE tools partition (Windows 8+)
if ($dest_windows_version.Name -imatch '^Windows (8|10)') {
$diskpart_script += "create partition primary size=300`r`n"
$diskpart_script += "format quick fs=ntfs label='Windows RE tools'`r`n"
$diskpart_script += "assign letter='T'`r`n"
$diskpart_script += "set id='de94bba4-06d1-4d40-a16a-bfd50179d6ac'`r`n"
$diskpart_script += "gpt attributes=0x8000000000000001`r`n"
}
# 2. System partition
$diskpart_script += "create partition efi size=260`r`n"
## NOTE: Allows for Advanced Format 4Kn drives
$diskpart_script += "format quick fs=fat32 label='System'`r`n"
$diskpart_script += "assign letter='S'`r`n"
# 3. Microsoft Reserved (MSR) partition
$diskpart_script += "create partition msr size=128`r`n"
# 4. Windows partition
$diskpart_script += "create partition primary`r`n"
$diskpart_script += "format quick fs=ntfs label='Windows'`r`n"
$diskpart_script += "assign letter='W'`r`n"
# Run script
Out-File -encoding 'UTF8' -filepath "$wd\diskpart.script" -inputobject $diskpart_script
Start-Process "diskpart" -argumentlist @("/s", "$wd\diskpart.script") -wait -nonewwindow | out-null
}
function format-mbr {
Param($dest_disk)
wk-write "Drive will use a MBR (legacy) layout."
if ($dest_disk.PartitionStyle -inotmatch '^RAW$') {
# Only clean if necessary
clear-Disk $dest_disk.DiskNumber -RemoveData -RemoveOEM -Confirm:$false | out-null
}
Initialize-Disk $dest_disk.DiskNumber -PartitionStyle 'MBR' | out-null
New-Partition -DiskNumber $dest_disk.DiskNumber -Size 100Mb -DriveLetter 'S' -IsActive:$true | out-null
New-Partition -DiskNumber $dest_disk.DiskNumber -UseMaximumSize -DriveLetter 'W' -IsActive:$false | out-null
Format-Volume -DriveLetter 'S' -FileSystem 'NTFS' -NewFileSystemLabel 'System Reserved' | out-null
Format-Volume -DriveLetter 'W' -FileSystem 'NTFS' -NewFileSystemLabel 'Windows' | out-null
}
function select-disk {
param([string]$title, [bool]$skip_usb=$false)
$_skipped_parts = 0
# Get Disk(s)
if ($skip_usb) {
$disks = @(Get-Disk | Where-Object {$_.Size -ne 0 -and $_.BusType -inotmatch 'USB'} | Sort-Object -Property "Number")
} else {
$disks = @(Get-Disk | Where-Object {$_.Size -ne 0} | Sort-Object -Property "Number")
}
# Check if any drives were detected
if ($disks.count -eq 0) {
wk-error "No suitable drives were detected."
return $false
}
# Get selection
$selection = $null
$main_set = @()
if ($disks.count -eq 1) {
# Only one disk is available
$selection = $disks[0]
} else {
# Multiple options. Build and use menu
foreach ($_ in $disks) {
$_entry = "{0}`t[{1}] ({2}) {3}" -f (human-size $_.Size 0), $_.PartitionStyle, $_.BusType, $_.FriendlyName
$main_set += @{Name=$_entry}
}
$actions = @(@{Name="Main Menu"; Letter="M"})
$selection = (menu-select $title $main_set $actions)
}
if ($selection -imatch '^\d+$') {
$selection -= 1
return $disks[$selection]
} else {
return $selection
}
}
function menu-imaging {
wk-write "Drive Imaging"
wk-write ""
## WARNING
wk-warn "WARNING: This section is experimental"
pause
## WARNING
# Service Order
$menu_service_order += "Please enter the service order`r`n"
do {
clear
$service_order = read-host -prompt $menu_service_order
} until ($service_order -imatch '^\d[\w\-]+$')
# Select Disk
$disk = (select-disk "For which drive are we creating backup image(s)?")
if (!($disk)) {
# No drives detected or user aborted
wk-warn "Drive Imaging aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
} elseif ($disk -imatch '^M$') {
# User selected to return to the menu
return $false
} elseif ($disk.DiskNumber -imatch '^\d+$') {
# Valid disk selected
clear
wk-write ("Disk:`t{0}`t[{1}] ({2}) {3}" -f (human-size $disk.Size 0), $disk.PartitionStyle, $disk.BusType, $disk.FriendlyName)
wk-write "Partition(s):"
# Print partition info
$partitions = Get-Partition -DiskNumber $disk.DiskNumber
$_skipped_parts = 0
foreach ($_p in $partitions) {
# Assign letter
Add-PartitionAccessPath -DiskNumber $disk.DiskNumber -PartitionNumber $_p.PartitionNumber -AssignDriveLetter 2>&1 | Out-Null
# Update partition info
$_p = Get-Partition -DiskNumber $disk.DiskNumber -PartitionNumber $_p.PartitionNumber
$_v = Get-Volume -Partition $_p
# Set size label
$_size = (human-size $_p.size 0)
$_used = ""
if ($_v) {
$_used = "({0} used)" -f (human-size ($_v.Size - $_v.SizeRemaining) 0)
}
# Print partition info
if ($_p.AccessPaths) {
# Has drive letter
$_path = $_p.AccessPaths | Where-Object {$_ -imatch '^\w:\\$'}
$_label = " {0}" -f $_p.Type
if ($_v -and $_v.FileSystemLabel -ne "") {
$_label = '"{0}"' -f $_v.FileSystemLabel
}
$_msg = " {0:N0}:`t{1} ({2,6}) {3} {4}" -f $_p.PartitionNumber, $_path, $_size, $_label, $_used
wk-write "$_msg"
} else {
# No drive letter
$_msg = " *{0:N0}:`t ({1}) {2}" -f $_p.PartitionNumber, $_size, $_p.Type
wk-error "$_msg"
$_skipped_parts += 1
}
}
if ($_skipped_parts -gt 0) {
wk-warn " *`tUnable to backup these partition(s)"
}
wk-write ""
if (!(ask " Backup these partition(s)?")) {
wk-warn "Drive Imaging aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
}
}
wk-write ""
# Mount server(s)
mount-servers
# Select Server
$server = (select-server)
if (!($server)) {
# No servers detected
wk-warn "Drive Imaging aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
} elseif ($server -imatch '^M$') {
# User selected to return to the menu
return
}
wk-write ""
wk-write ("Saving partition backups to: {0}" -f $server.Description)
wk-write ""
# Backup partitions
$partitions = Get-Partition -DiskNumber $disk.DiskNumber
foreach ($_p in $partitions) {
$_v = Get-Volume -Partition $_p
$_name = "{0}" -f $_p.PartitionNumber
if ($_v -and $_v.FileSystemLabel -ne "") {
$_name += "_{0}" -f $_v.FileSystemLabel
} else {
$_name += "_{0}" -f $_p.Type
}
# Sanitize the name
$_name = $_name -replace '\s', '_'
$_imagepath = "{0}{1}" -f $server.Root, $service_order
$_imagefile = "{0}{1}\{2}.wim" -f $server.Root, $service_order, $_name
if ($_p.AccessPaths -ne $null) {
# Avoid unwanted clobbering
if (Test-Path "$_imagefile") {
if (!(ask ("Overwrite backup image: {0}" -f $_imagefile))) {
wk-warn "Drive Imaging aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
}
}
$_capturedir = $_p.AccessPaths | Where-Object {$_ -imatch '^\w:\\$'}
# Take image
wk-write (" Imaging partition {0} --> `"{1}`"" -f $_p.PartitionNumber, $_imagefile)
if (!(Test-Path "$_imagepath")) {
mkdir "$_imagepath" | out-null
}
$_dism_args = @(
'/Capture-Image',
'/ImageFile:$_imagefile',
'/CaptureDir:$_capturedir',
'/Name:$_name',
'/Compress:fast',
'/Quiet')
Start-Process "$windir\System32\Dism.exe" -ArgumentList $_dism_args -NoNewWindow -Wait | out-null
## The following command fails to capture OS partitions consitantly. Until this is fixed I will use DISM directly (as above).
#New-WindowsImage -ImagePath "$_imagefile" -CapturePath "$_capturedir" -Name "$_name" -CompressionType "fast" | out-null
# Verify image
## Code borrowed from: https://stackoverflow/a/10262275
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "$WKPath\7-Zip\7z.exe"
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = 't "{0}"' -f $_imagefile
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
write-host " Verifying . . . " -NoNewline
$p.WaitForExit()
if ($p.ExitCode -eq 0) {
write-host "Complete." -foreground "green"
} else {
write-host "Failed." -foreground "red"
}
}
}
# Unmount server(s)
unmount-servers
pause "Press Enter to return to main menu... "
}
function menu-setup {
# Select Disk
$dest_disk = (select-disk "To which drive are we installing Windows?" -skip_usb=$true)
if (!($dest_disk)) {
# No drives detected or user aborted
wk-warn "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
} elseif ($dest_disk -imatch '^M$') {
# User selected to return to the menu
return $false
} elseif ($dest_disk.DiskNumber -inotmatch '^\d+$') {
# This shouldn't happen?
throw
} else {
wk-warn "All data will be deleted from the following drive:"
wk-warn ("`t{0}`t({1}) {2}`r`n" -f (human-size $dest_disk.Size 0), $dest_disk.PartitionStyle, $dest_disk.FriendlyName)
if (!(ask "Proceed and install Windows?")) {
wk-warn "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
}
}
# Set available Windows versions
$windows_versions = @(
@{Name="Windows 7 Home Basic"; ImageFile="Win7"; ImageName="Windows 7 HOMEBASIC"}
@{Name="Windows 7 Home Premium"; ImageFile="Win7"; ImageName="Windows 7 HOMEPREMIUM"}
@{Name="Windows 7 Professional"; ImageFile="Win7"; ImageName="Windows 7 PROFESSIONAL"}
@{Name="Windows 7 Ultimate"; ImageFile="Win7"; ImageName="Windows 7 ULTIMATE"}
@{Name="Windows 8.1"; ImageFile="Win8"; ImageName="Windows 8.1"; CRLF=$true}
@{Name="Windows 8.1 Pro"; ImageFile="Win8"; ImageName="Windows 8.1 Pro"}
# The ISOs from the MediaCreationTool are apparently Technical Previews
@{Name="Windows 10 Home"; ImageFile="Win10"; ImageName="Windows 10 Technical Preview"; CRLF=$true}
@{Name="Windows 10 Pro"; ImageFile="Win10"; ImageName="Windows 10 Pro Technical Preview"}
)
# Build menu and get selection
$dest_windows_version = $null
$selection = $null
$actions = @(@{Name="Main Menu"; Letter="M"})
$selection = (menu-select "Which version of Windows are we installing?" $windows_versions $actions)
if ($selection -imatch '^M$') {
# User selected to return to the menu
return $false
} elseif ($selection -inotmatch '^\d+$') {
# This shouldn't happen?
throw
} else {
$selection -= 1
$dest_windows_version = $windows_versions[$selection]
}
# Double check before deleting data
wk-warn "SAFTEY CHECK:"
wk-write (" Installing:`t{0}" -f $dest_windows_version.Name)
wk-error (" And ERASING:`tDisk: {0}`t({1}) {2}`r`n" -f (human-size $dest_disk.Size 0), $dest_disk.PartitionStyle, $dest_disk.FriendlyName)
if (!(ask "Is this correct?")) {
wk-warn "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
}
## WARNING
wk-warn "WARNING: This section is experimental"
## WARNING
## Here be dragons
try {
# Select UEFI or BIOS partition layout
if ($UEFI) {
# System booted via UEFI so assume new layout should be GPT
if (ask "Setup drive using GPT (UEFI) layout?") {
format-gpt $dest_disk
} else {
format-mbr $dest_disk
}
} else{
if (ask "Setup drive using MBR (legacy) layout?") {
format-mbr $dest_disk
} else {
format-gpt $dest_disk
}
}
# Apply image
apply-image $dest_windows_version.ImageFile $dest_windows_version.ImageName
# Create boot files (copies files for both Legacy and UEFI)
wk-write " Copying boot files..."
bcdboot W:\Windows /s S: /f ALL 2>&1 | out-null
if ($dest_windows_version.Name -imatch '^Windows (8|10)') {
W:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target W:\Windows 2>&1 | out-null
}
# Done
wk-write "Windows Setup complete."
wk-write ""
pause "Press Enter to return to main menu... "
} catch {
# Error(s)
wk-error "$Error"
wk-error "Windows Setup aborted."
wk-write ""
pause "Press Enter to return to main menu... " -warning=$true
return $false
}
}

View file

@ -4,9 +4,26 @@
$host.UI.RawUI.BackgroundColor = "black" $host.UI.RawUI.BackgroundColor = "black"
$host.UI.RawUI.ForegroundColor = "cyan" $host.UI.RawUI.ForegroundColor = "cyan"
#$appdata = (gci env:appdata).value
#$localappdata = (gci env:localappdata).value
#$username = (gci env:username).value
#$userprofile = (gci env:userprofile).value
$systemdrive = (gci env:systemdrive).value $systemdrive = (gci env:systemdrive).value
$windir = (gci env:windir).value
#$programfiles = (gci env:programfiles).value
#$programfiles86 = $programfiles
#if (test-path env:"programfiles(x86)") {
# $programfiles86 = (gci env:"programfiles(x86)").value
#}
$WKPath = "$systemdrive\WK" $WKPath = "$systemdrive\WK"
$date = get-date -uformat "%Y-%m-%d" $date = get-date -uformat "%Y-%m-%d"
#$logpath = "$WKPath\Info\$date"
# Check if booted via UEFI
$UEFI = $false
if ((Get-ItemProperty -path "HKLM:\System\CurrentControlSet\Control").PEFirmwareType -eq 2) {
$UEFI = $true
}
function ask { function ask {
param([string]$text = "Kotaero", [string]$log = "WK.log") param([string]$text = "Kotaero", [string]$log = "WK.log")
@ -56,6 +73,80 @@ function human-size {
} }
return $size return $size
} }
function menu-select {
## $MainEntries should be an "AoH" object (with at least the key "Name" for each item)
## NOTE: if the CRLF=$true; then a spacer is added before that entry.
## Example:
## $MainEntries = @(
## @{Name="Windows 10 Home"; ImageFile="Win10"; ImageName="Windows 10 Home"}
## @{Name="Windows 10 Pro"; ImageFile="Win10"; ImageName="Windows 10 Pro"}
##)
## $ActionEntries should be an "AoH" object (with at least the keys "Name" and "Letter" for each item)
## NOTE: if the CRLF=$true; then a spacer is added before that entry.
## Example:
## $ActionEntries = @(
## @{Name="Reboot"; Letter="R"}
## @{Name="Shutdown"; Letter="S"}
##)
param(
[string]$Title = "## Untitled Menu ##",
$MainEntries = @(),
$ActionEntries = @(),
[string]$Prompt = "Please make a selection",
[bool]$SecretExit = $false
)
# Bail early if no items given
if ($MainEntries.length -eq 0 -and $ActionEntries.length -eq 0) {
throw "MenuError: No items given."
}
# Build menu
$menu_splash = "{0}`r`n`r`n" -f $title
$valid_answers = @()
if ($SecretExit) {
$valid_answers += "Q"
}
# Add main items to splash
if ($MainEntries.length -gt 0) {
for ($i=0; $i -lt $MainEntries.length; $i++) {
if ($MainEntries[$i].CRLF) {
# Add spacer
$menu_splash += "`r`n"
}
$valid_answers += ($i + 1)
$menu_splash += "{0,2:N0}: {1}`r`n" -f ($i + 1), $MainEntries[$i].Name
}
$menu_splash += "`r`n"
}
# Add action items to splash
if ($ActionEntries.length -gt 0) {
foreach ($_item in $ActionEntries) {
if ($_item.CRLF) {
# Add spacer
$menu_splash += "`r`n"
}
$menu_splash += " {0}: {1}`r`n" -f $_item.Letter.ToUpper(), $_item.Name
$valid_answers += $_item.Letter.ToLower(), $_item.Letter.ToUpper()
}
$menu_splash += "`r`n"
}
# Add prompt to splash
$menu_splash += "{0}`r`n" -f $prompt
# Select Windows version
do {
clear
$answer = read-host -prompt $menu_splash
} until ($valid_answers -contains $answer)
return $answer.ToUpper()
}
function pause { function pause {
param([string]$message = "Press Enter to continue... ", [bool]$warning = $False) param([string]$message = "Press Enter to continue... ", [bool]$warning = $False)
if ($warning) { if ($warning) {

85
WK/Scripts/servers.ps1 Normal file
View file

@ -0,0 +1,85 @@
# WK server functions
## Init ##
$wd = $(Split-Path $MyInvocation.MyCommand.Path)
pushd "$wd"
. .\init.ps1
# Variables
$source_server = "10.0.0.10"
$backup_servers = @(
@{ "ip"="10.0.0.10";
"letter"="Z";
"name"="ServerOne";
"path"="Backups"},
@{ "ip"="10.0.0.11";
"name"="ServerTwo";
"letter"="Y";
"path"="Backups"}
)
$backup_user = "backup"
$backup_pass = "Abracadabra"
# Functions
function select-server {
# Check for available servers
$avail_servers = @(Get-PSDrive | Where-Object {$_.DisplayRoot -imatch '\\\\'})
if ($avail_servers.count -eq 0) {
wk-error "No suitable backup servers were detected."
return $false
}
# Build menu and get selection
$selection = $null
$main_set = @()
foreach ($server in $avail_servers) {
$_entry = "{0} ({1} free)" -f $server.Description, (human-size $server.Free)
$main_set += @{Name=$_entry}
}
$actions = @(@{Name="Main Menu"; Letter="M"})
$selection = (menu-select "Where are we saving the backup image(s)?" $main_set $actions)
if ($selection -imatch '^\d+$') {
$selection -= 1
return $avail_servers[$selection]
}
return $selection
}
function mount-servers {
# Mount servers
wk-write "Connecting to backup server(s)"
foreach ($_server in $backup_servers) {
if (test-connection $_server.ip -count 3 -quiet) {
try {
$_path = "\\{0}\{1}" -f $_server.ip, $_server.path
$_drive = "{0}:" -f $_server.letter
net use $_drive "$_path" /user:$backup_user $backup_pass | Out-Null
wk-write ("`t{0} server: mounted" -f $_server.name)
# Add friendly description
$_regex = "^{0}$" -f $_server.letter
(Get-PSDrive | Where-Object {$_.Name -imatch $_regex}).Description = $_server.name
} catch {
wk-warn ("`t{0} server: failed" -f $_server.name)
}
} else {
wk-warn ("`t{0} server: timed-out" -f $_server.name)
}
}
}
function unmount-servers {
# Unmount servers
wk-write "Disconnecting from backup server(s)"
$mounted_servers = @(Get-PSDrive | Where-Object {$_.DisplayRoot -imatch '\\\\'})
foreach ($_server in $mounted_servers) {
try {
$_drive = "{0}:" -f $_server.Name
net use $_drive /delete | Out-Null
#wk-warn ("`t{0} server: unmounted" -f $_server.name)
wk-warn "`tServer: unmounted"
} catch {
#wk-warn ("`t{0} server: failed" -f $_server.name)
wk-warn "`tServer: failed"
}
}
}

View file

@ -5,6 +5,8 @@ setlocal EnableDelayedExpansion
title WinPE 10 creation tool title WinPE 10 creation tool
color 1b color 1b
pushd %~dp0 pushd %~dp0
set "wd=%cd%"
set "pe_iso=WinPE-2016-02d.iso"
:Flags :Flags
for %%f in (%*) do ( for %%f in (%*) do (
@ -12,8 +14,9 @@ for %%f in (%*) do (
) )
:CreateISO :CreateISO
del winpe10-test.iso del "!pe_iso!"
makewinpemedia.cmd /iso pe_files winpe10-test.iso makewinpemedia.cmd /iso "%wd%\pe_files" "!pe_iso!"
goto Done
:Abort :Abort
echo. echo.

View file

@ -7,7 +7,7 @@ color 1b
pushd %~dp0 pushd %~dp0
set "wd=%cd%" set "wd=%cd%"
set "winpe_ocs=%programfiles(x86)%\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs" set "winpe_ocs=%programfiles(x86)%\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs"
set "pe_iso=WinPE-2016-02d.iso"
:Flags :Flags
for %%f in (%*) do ( for %%f in (%*) do (
@ -62,29 +62,38 @@ dism /add-package /image:"%wd%\mount" /packagepath:"%winpe_ocs%\en-us\WinPE-Enha
del "%wd%\WK\Scripts\WK.log" del "%wd%\WK\Scripts\WK.log"
mkdir "%wd%\mount\WK" mkdir "%wd%\mount\WK"
robocopy /e "%wd%\WK" "%wd%\mount\WK" robocopy /e "%wd%\WK" "%wd%\mount\WK"
mklink "%wd%\mount\System32\explorer.exe" "%wd%\mount\WK\Explorer++.exe" del "%wd%\mount\Windows\explorer.exe"
mklink /h "%wd%\mount\Windows\explorer.exe" "%wd%\mount\WK\Explorer++\Explorer++64.exe"
:MenuLauncher :System32Stuff
copy /y "%wd%\System32\menu.cmd" "%wd%\mount\Windows\System32\menu.cmd" copy /y "%wd%\System32\menu.cmd" "%wd%\mount\Windows\System32\menu.cmd"
copy /y "%wd%\System32\Winpeshl.ini" "%wd%\mount\Windows\System32\Winpeshl.ini"
:ReplaceStartnet :RegistryEdits
copy /y "%wd%\System32\startnet.cmd" "%wd%\mount\Windows\System32\startnet.cmd"
:ReplaceNotepad
reg load HKLM\WinPE-SW mount\Windows\System32\config\SOFTWARE reg load HKLM\WinPE-SW mount\Windows\System32\config\SOFTWARE
reg add "HKLM\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v Debugger /t REG_SZ /d "X:\WK\Notepad2.exe /z" /f reg load HKLM\WinPE-SYS mount\Windows\System32\config\SYSTEM
rem Add 7-Zip to path
reg add "HKLM\WinPE-SYS\ControlSet001\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32;%%SystemRoot%%;%%SystemRoot%%\System32\Wbem;%%SYSTEMROOT%%\System32\WindowsPowerShell\v1.0\;%%SystemDrive%%\WK\7-Zip" /f
rem Replace Notepad
reg add "HKLM\WinPE-SW\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v Debugger /t REG_SZ /d "X:\WK\Notepad2\Notepad2-Mod64.exe /z" /f
rem Unload registry hives
reg unload HKLM\WinPE-SW reg unload HKLM\WinPE-SW
reg unload HKLM\WinPE-SYS
:Background :Background
takeown /f "%wd%\mount\Windows\System32\winpe.jpg" /a takeown /f "%wd%\mount\Windows\System32\winpe.jpg" /a
icacls "%wd%\mount\Windows\System32\winpe.jpg" /grant administrators:F icacls "%wd%\mount\Windows\System32\winpe.jpg" /grant administrators:F
copy /y "%wd%\System32\winpe.jpg" "%wd%\mount\Windows\System32\winpe.jpg" copy /y "%wd%\System32\winpe.jpg" "%wd%\mount\Windows\System32\winpe.jpg"
copy /y "%wd%\System32\winpe.jpg" "%wd%\mount\WK\ConEmu\winpe.jpg"
:ManualStuff :ManualStuff
echo Now is the time to add stuff (optional). REM echo Now is the time to add stuff (optional).
echo. REM echo.
echo Press any key to commit changes... REM echo Press any key to commit changes...
pause>nul REM pause>nul
:Set-ScratchSpace :Set-ScratchSpace
rem Force RamDisk size to try and avoid capture-image errors rem Force RamDisk size to try and avoid capture-image errors
@ -94,8 +103,8 @@ dism /image:"%wd%\mount" /set-scratchspace:512
dism /unmount-image /mountdir:"%wd%\mount" /commit dism /unmount-image /mountdir:"%wd%\mount" /commit
:CreateISO :CreateISO
del winpe10-2016.iso del "!pe_iso!"
makewinpemedia.cmd /iso "%wd%\pe_files" winpe10-2016.iso makewinpemedia.cmd /iso "%wd%\pe_files" "!pe_iso!"
goto Done goto Done
:Abort :Abort