Forgot how to do something - post install of Windows

Discussion in 'Discussion' started by zdevilinside, Sep 5, 2021.

  1. zdevilinside

    zdevilinside Active Member

    I cannot remember for the life of me how to make it so that Windows 10 will run an .exe immediately after installing the OS.

    We have a couple of specialized .exe files that need to be run to install Ninja RMM, Malwarebytes Oneview, and a couple of other things that need to run with the "first login" of the system. Where do I put the .exe files and where do I script the installs?

    Thanks in advance!
     
  2. Trouba

    Trouba Administrator Staff Member

    Did you try via SetupComplete.cmd? I think SetupComplete gets disabled when using OEM keys, though, if I'm not mistaken. In the case of (silent) app installs, just make sure not to include parameters like "reboot" or "shutdown" etc. Otherwise you may try via Autounattend.xml.

    In the LastOS builds a .cmd called firstlogon.cmd is called from Autounattend.xml on root of iso which in turn calls various scripts that allow for running .reg, .exe, etc., files in certain folders. This is an easy method (once put in place) because it allows you to just throw .reg and .bat/cmd and .exe files in certain folders and they automatically get run.

    Alternatively, you could utilize sysprep and preinstall these apps (make it part of install.wim/esd) but that is perhaps more feasible if you always intend to have those apps be part of the install and then of course depending on what user account you'd want this to apply to, etc. SetupComplete.cmd (if you can use it) would be the easiest method, probably.
     
  3. Ghost

    Ghost Forum Crapolator

    Just a bit of info that I did not realize is this ..

    • %WINDIR%\Setup\Scripts\SetupComplete.cmd: This script runs immediately after the user sees the desktop. This setting is disabled when using OEM product keys. It runs with local system permission.
    As Trouba pointed out above this is useful info to know.

    Using setupcomplete.cmd is rather touchy, and easy.

    name the file to setupcomplete.cmd and add this to the file and save, add to the root of the .ISO in folder ( if not already created, create the folder structure )

    sources\$oem$\$$\Setup\scripts

    Code:
    @echo off
    
    %~dp0"Chrome-v91-2021.exe" /silent /install
    
    
    and then there is the start wait command that waits for each app to finish before starting the next install like

    Code:
    @echo off
    
    start /wait %~dp0"Chrome-v91-2021.exe" /silent /install
    
    
    the only issue with start /wait is if the application being installed is calling other .exe or .msi executables, it will only wait for the .exe or .msi that is called initially and will move on to the next install when the initial .exe or .msi has closed out.
     
    Last edited: Sep 6, 2021
  4. Ghost

    Ghost Forum Crapolator

    I forgot to add that the .exe or .msi executable need to be in the same folder as the setupcomplete.cmd in root of .iso folder ..

    sources\$oem$\$$\Setup\scripts

    also each application will have its own command line switches for install, rather silent or user action needed, just make sure to get those command line arguments :)
     

Share This Page