[REPO/HOW-TO/CHAT] Audit/Sysprep/Generalize; Setupcomplete/Firstlogon; Silent Install

Discussion in 'Scripting' started by s1ave77, Feb 11, 2017.

  1. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,276
    929
    60
    #221 Chibi ANUBIS, Oct 4, 2022
    Last edited: Oct 4, 2022
    Oh my old friend, I'm enjoy to see you here, I'm fine and you ?
    Is because the SetupComplete.cmd is not run when a OEM key is injected, I looking for a alternative...

    IS OK NOW !! :)

    CleanUp.cmd
    Code:
    IF EXIST %windir%\Setup\scripts RD /S /Q %windir%\Setup\scripts >nul
    DEL /F /Q %0% >nul
    
    And I add this line to my RunOnceEx.cmd before reboot
    Code:
    REM CleanUp
    REG ADD %ROE%\012 /v "01_CleanUp" /d "%WinDir%\System32\wscript.exe //nologo %WinDir%\setup\scripts\invisible.vbs %WinDir%\setup\scripts\CleanUp.cmd" /f
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. migascalp

    migascalp MDL Senior Member

    Sep 18, 2009
    459
    785
    10
    I use a command like this to delete a folder:
    Code:
    reg add HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v remove_Scripts /t REG_SZ /d "cmd.exe /q /c rmdir /s /q \"%windir%\Setup\scripts\"" /f >nul 2>&1
    Edit:
    Too late
    You finally found a solution :)
     
  3. Chibi ANUBIS

    Chibi ANUBIS MDL Chibi Developer

    Apr 28, 2014
    1,276
    929
    60
    Thank you !
    I have already try with RunOnce, but the registry won't load.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. NathanIT

    NathanIT MDL Novice

    Jun 15, 2021
    24
    1
    0
    How to disable "checking for updates" during sysprep? Appears when I connect to LAN. Thanks
     

    Attached Files:

  5. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    49,901
    104,491
    450
    #225 Enthousiast, Dec 23, 2022
    Last edited: Dec 23, 2022
    Atm there is no update installed during OOBE on 11 (last time i checked), but to be sure just keep the vm/system offline during OOBE.

    Usually people go into Audit mode (CTRL+SHIFT+F3 on first OOBE screen) to sysprep, then no OOBE questions/settings are asked to do and no updates are installed during it.
    [​IMG]
     
  6. NathanIT

    NathanIT MDL Novice

    Jun 15, 2021
    24
    1
    0
    if not disconnect from internet, during installation is there any way to disable checking for update when running sysprep? Because PC is always plugged in LAN
     
  7. KleineZiege

    KleineZiege MDL Expert

    Dec 11, 2018
    1,882
    2,124
    60
    #227 KleineZiege, Dec 25, 2022
    Last edited: Dec 26, 2022
    what is written here is totally old school

    Today it is no longer done that way

    why don't you run sysprep in a vmware.

    the first image created must never have contact with a network adapter.
    massive Problems when you do that

    then you create clones from the first image.

    Edit: I forgot something, you must not install in the first image, you only do that in linked clone.
    Thab clone the 2second image.

    3. Clone your delete the appx
    with command : Get-AppxPackage -AllUsers | Remove-AppxPackage

    4 Clone: command Sysprep dont Reboot

    Clone the 4 Image

    Then use 5 command

    5: Command: boot in Shell from iso / CD / : ALT: pres F10
    very easy in vmware


    thane use command: diskpart / list vol
    Then u see was parameter the Lokal Destination.

    exit This command with exit

    Use in shell:

    X:\windows\system32\dism.exe /capture-image /imagefile:X:\sources\install.wim /capturedir:X: /name:"YourImagename" /compress:maximum

    The [ X ] youse your destination from
    Diskpart.

    X

    When Down your have a install.wim,

    use ximage for Flags

    https://wimlib.net/downloads/

    wimlib-imagex.exe info install.wim 1 --image-property NAME="Windows 10-11 YourName" --image-property DESCRIPTION="Windows 10-11 YourName" --image-property FLAGS="Pro or Enterprise" --image-property DISPLAYNAME="Windows 10-11 YourName" --image-property DISPLAYDESCRIPTION="Windows 10-11 YourName"

    I'll make you a video at noon today, with 2 programmes, otherwise it would take too long.



    [​IMG]
     

    Attached Files:

  8. zbigniew59

    zbigniew59 MDL Senior Member

    May 14, 2016
    373
    171
    10
    Hello.
    I'm not good with scripts - but I've mastered what I want a bit.
    I use the $OEM$ folder - with my modifications.
    I am trying to add a file to this folder - windowsdesktop-runtime-3.1.28-win-x64.exe
    But I don't know what parameter to use - /.....
    /S
    /verysilent
    /ai
    These parameters cause - either an endless loop - or - /ai - during the installation it pops up a window - next - and I can't do anything.
    Similar file -
    start /wait %WINDIR%\Setup\Files\VisualCppRedist_AIO_x86_x64.exe /ai
    start /wait %WINDIR%\Setup\Files\DirectX_Redist_Repack_x86_x64.exe /ai
    they install without a problem.

    Can anyone help?
     
  9. migascalp

    migascalp MDL Senior Member

    Sep 18, 2009
    459
    785
    10
    #229 migascalp, May 31, 2023
    Last edited: May 31, 2023
    Hello

    it's Microsoft so I'll try an MSI argument

    /quiet

    also try this sometimes it can help

    windowsdesktop-runtime-3.1.28-win-x64.exe /?

    Edit:
    try too

    /V/qn
    /V/quiet
     
  10. zbigniew59

    zbigniew59 MDL Senior Member

    May 14, 2016
    373
    171
    10
    Thank you very much for help. :worthy:
     
  11. JeepWillys58

    JeepWillys58 MDL Addicted

    Nov 6, 2010
    604
    380
    30
    Hi dear friend @zbigniew59

    In first place I hope tha you and all yours be safe and heathly.

    Is possible that you share your modifications folder, I'm interrested to see that your modifications do and also learn how to do it.

    Thanks in advanced!

    Best Regards and Good Computing.

    @JeepWillys58
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. zbigniew59

    zbigniew59 MDL Senior Member

    May 14, 2016
    373
    171
    10
  13. JeepWillys58

    JeepWillys58 MDL Addicted

    Nov 6, 2010
    604
    380
    30
    Thank you my friend,

    Language is not a problem, nowadays we can use many tools to translate, even ChatGPT, by the way my native language is pt-br.

    GRATITUDE for your kindness and willingness to share.

    God bless you always.

    Kind Regards,
    @JeepWillys58
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. amsk98

    amsk98 MDL Junior Member

    Sep 8, 2013
    82
    5
    0
    Create Custom Windows 11 Image With Applications Pre-installed

    hi i am install Win 11 pro os with require software and then run sysprep cmd %WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe after that

    I boot winpe and then run dism.exe /capture-image /ImageFile:"D:\install.wim" /CaptureDir:C:\ /Name:win11apps /compress:max

    i copy install.wim into original Windows iso with anyburn utility

    an try to install os

    but fail getting below error

    upload_2023-10-14_16-26-5.jpeg
     
  15. pm67310

    pm67310 MDL Guru

    Sep 6, 2011
    3,425
    2,606
    120
    check this

    https://theitbros.com/sysprep-windows-machine/
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. amsk98

    amsk98 MDL Junior Member

    Sep 8, 2013
    82
    5
    0
    #237 amsk98, Oct 31, 2023
    Last edited by a moderator: Oct 31, 2023
  17. pm67310

    pm67310 MDL Guru

    Sep 6, 2011
    3,425
    2,606
    120
    use windows built-in are the best methode
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. ITIdiot

    ITIdiot MDL Novice

    Jul 28, 2023
    3
    0
    0
    Maybe this isn't the right thread for this question, point me in the right direction if not.

    Is there a way to make an autounattend file actually stop (without crashing) when there's no disk 0 to install on? Checking the 'On Error' flag still makes it throw an error and kill the entire installation process. I have to have two different unattend files for installion 10 and 11 (4 total) based on this. Yes, I know injecting drivers is a thing, but where I work I'm not really at that point yet, plus we have so much sprawl on laptops that it's usually not something I find out until I'm actively installing.

    Can I replace the step in the answer file with a script that formats and partitions the drives, waits for user input if no disk exists to install on, then goes back to automating all of OOBE afterwards? Is that even possible? And again, yes, I know about MDT - I'm near the process of going down that road soon enough. But in the short term, this would be a nice thing to have fixed.
     
  19. maargueb

    maargueb MDL Member

    Jun 9, 2019
    220
    35
    10
    #240 maargueb, Mar 31, 2024
    Last edited: Mar 31, 2024
    I want to execute these commands in a file setupcomplete.cmd
    sources\$OEM$\$1\windows\setup\scripts\setupcomplete.cmd
    sources\$OEM$\$$\system32\OEM\logo.bmp
    -How do I write a text setupcomplete.cmd

    Code:
    :: set "Brand" details
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v "Logo" /t REG_SZ /d "%SystemRoot%\System32\OEM\logo.bmp" /f
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v "Manufacturer" /t REG_SZ /d "Dell Inc." /f
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v "Model" /t REG_SZ /d "Vostro 15-3568" /f
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v "SupportHours" /t REG_SZ /d "Monday to Friday 9 a.m. - 6 p.m." /f
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v "SupportPhone" /t REG_SZ /d "080-2510-8037" /f
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" /v "SupportURL" /t REG_SZ /d "https://www.dell.com/support/home/en-in" /f
    
    And Add autounattend.xml To execute commands with a file setup complete.cmd

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <ImageInstall>
                    <OSImage>
                        <InstallFrom>
                            <MetaData wcm:action="add">
                                <Key>/IMAGE/DESCRIPTION</Key>
                                <Value>Windows 10 Pro</Value>
                            </MetaData>
                        </InstallFrom>
                    </OSImage>
                </ImageInstall>
                <UserData>
                    <ProductKey>
                        <Key>W269N-WFGWX-YVC9B-4J6C9-T83GX</Key>
                    </ProductKey>
                </UserData>
            </component>
        </settings>
        <settings pass="specialize">
            <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <RunSynchronous>
                    <RunSynchronousCommand wcm:action="add">
                        <Order>1</Order>
                        <Path>%windir%\Setup\Scripts\specialize.cmd</Path>
                    </RunSynchronousCommand>
                </RunSynchronous>
            </component>
        </settings>
        <settings pass="oobeSystem">
            <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <InputLocale>040c:0000040c</InputLocale>
                <SystemLocale>fr-FR</SystemLocale>
                <UILanguage>fr-FR</UILanguage>
                <UserLocale>fr-FR</UserLocale>
            </component>
        </settings>
    </unattend>