Windows 10: Correct way to run scripts in automated, unattended Windows installation

Discus and support Correct way to run scripts in automated, unattended Windows installation in Windows 10 Installation and Upgrade to solve the problem; I have some custom scripts that I have written to customise Windows 10 such as removing bloatware and setting file explorer options via Registry Editor... Discussion in 'Windows 10 Installation and Upgrade' started by firewire10000, Dec 28, 2020.

  1. Correct way to run scripts in automated, unattended Windows installation


    I have some custom scripts that I have written to customise Windows 10 such as removing bloatware and setting file explorer options via Registry Editor that I use to apply to all users and/or the system.

    I have created a `autounattend.xml` Answer File with some simple parameters such as formatting the disk, creating partitions and selecting the version of Windows to install etc and then using the `reseal` parameter to log the computer into Audit Mode automatically after the initial installation and bypassing the OOBE screen.

    My scripts have all been tested in Audit Mode CTRL, SHIFT + F3 from the OOBE screen and they work perfectly fine for any proceeding user that uses the system once it's in normal working order. Additionally, I use an `unattend.xml` file located in `$OEM$\$$\System32\Sysprep` within the installation media to finish the installation after I leave Sysprep and restart the computer. This sets up a new local administration account and password that logs automatically into the desktop. Essentially I have two unattend Answer Files split into two parts so I'm not actually sure if this is the correct way of doing it, but it seems to work well.

    I would now like to automate the installation completely so that the scripts I currently manually run in Audit Mode execute without any user intervention. In Windows System Image Manager there is the `RunAsynchronousCommand` component found under `amd64_Microsoft-Windows-Deployment_10.0.19041.1_neutral` which can only be added to `Pass 6 auditUser`. Within the `$OEM$` folder on my installation media is the following directory structure `$1\Scripts`, and this contains various Batch and PowerShell scripts. I would like to point the path parameter of `RunAsynchronousCommand` to the Scripts folder the `$OEM$` folder creates but nothing ever seems to work.

    Because I'm using two-part Answer Files, should I be placing `RunAsynchronousCommand` into my `autounattend.xml` or `unattend.xml` Answer File?

    With everything all working, do I need to remove any of the `Reseal` properties from the Answer File?

    Below are the contents of my two Answer Files located on my installation media:

    **/autounattend.xml**
    ````
    <?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">
    <EnableNetwork>false</EnableNetwork>
    <ImageInstall>
    <OSImage>
    <InstallFrom>
    <MetaData wcm:action="add">
    <Key>/IMAGE/NAME</Key>
    <Value>Windows 10 Pro</Value>
    </MetaData>
    </InstallFrom>
    <WillShowUI>Always</WillShowUI>
    </OSImage>
    </ImageInstall>
    <UserData>
    <ProductKey>
    <WillShowUI>Always</WillShowUI>
    <Key />
    </ProductKey>
    <AcceptEula>true</AcceptEula>
    </UserData>
    </component>
    <component name="Microsoft-Windows-International-Core-WinPE" 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">
    <SetupUILanguage>
    <UILanguage>en-gb</UILanguage>
    <WillShowUI>Always</WillShowUI>
    </SetupUILanguage>
    <InputLocale>en-gb</InputLocale>
    <SystemLocale>en-gb</SystemLocale>
    <UILanguageFallback>en-us</UILanguageFallback>
    <UILanguage>en-gb</UILanguage>
    </component>
    </settings>
    <settings pass="oobeSystem">
    <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">
    <Reseal>
    <Mode>Audit</Mode>
    </Reseal>
    </component>
    </settings>
    <cpiCorrect way to run scripts in automated, unattended Windows installation :eek:fflineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    ````

    **$OEM$/$$/System32/Sysprep/Unattend.xml**
    ````
    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
    <component name="Microsoft-Windows-Shell-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">
    <AutoLogon>
    <Password>
    <Value>cABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
    <PlainText>false</PlainText>
    </Password>
    <Enabled>true</Enabled>
    <LogonCount>1</LogonCount>
    <Username>LocalAdmin</Username>
    </AutoLogon>
    <UserAccounts>
    <LocalAccounts>
    <LocalAccount wcm:action="add">
    <Password>
    <Value>cABhAHMAcwB3AG8AcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
    <PlainText>false</PlainText>
    </Password>
    <Name>LocalAdmin</Name>
    <Group>Administrators</Group>
    <DisplayName></DisplayName>
    <Description>Local adminstrator stored on the system drive</Description>
    </LocalAccount>
    </LocalAccounts>
    </UserAccounts>
    <OOBE>
    <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
    <HideEULAPage>true</HideEULAPage>
    <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
    <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
    <ProtectYourPC>3</ProtectYourPC>
    <HideLocalAccountScreen>true</HideLocalAccountScreen>
    <SkipUserOOBE>true</SkipUserOOBE>
    <SkipMachineOOBE>true</SkipMachineOOBE>
    </OOBE>
    <BluetoothTaskbarIconEnabled>true</BluetoothTaskbarIconEnabled>
    <DesktopOptimization>
    <ShowWindowsStoreAppsOnTaskbar>false</ShowWindowsStoreAppsOnTaskbar>
    <GoToDesktopOnSignIn>true</GoToDesktopOnSignIn>
    </DesktopOptimization>
    <StartTiles>
    <PromoteOEMTiles>false</PromoteOEMTiles>
    </StartTiles>
    </component>
    </settings>
    <cpiCorrect way to run scripts in automated, unattended Windows installation :eek:fflineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    ````

    :)
     
    firewire10000, Dec 28, 2020
    #1
  2. Kari Win User

    Create media for automated unattended install of Windows 10

    The ImageInstall > OSImage > InstallTo belongs to component Microsoft-Windows-Setup_neutral, and tells Windows Setup on which disk and partition WIndows should be installed:


    Correct way to run scripts in automated, unattended Windows installation [​IMG]


    To fix this validation error, the solution is exactly as what you did: set disk ID and partition number in Configuration pass 1 WindowsPE, in setting ImageInstall > OSImage > InstallTo.


    A strange comment! The tutorial step 3.18 quite clearly tells and shows this. Screenshot of that step:


    Correct way to run scripts in automated, unattended Windows installation [​IMG]
     
  3. Kari Win User
    Create media for automated unattended install of Windows 10  


    At the very end of the tutorial is short Step Eight. If you have followed the tutorial steps One through Seven, this last step contains two links:

    Correct way to run scripts in automated, unattended Windows installation [​IMG]


    The one highlighted yellow contains link to a tutorial to show how to create a USB install media: PowerShell Scripting - Create USB Install Media for Windows 10 | Windows 10 Tutorials

    The link highlighted blue contains a link to a tutorial which instructs how to use OSCDIMG.EXE (which replaced now deprecated ImageX) to create a bootable ISO image: Create Windows 10 ISO image from Existing Installation | Windows 10 Tutorials
     
  4. x509 Win User

    Correct way to run scripts in automated, unattended Windows installation

    Automating installation rename optical and SSD/HDD during post install

    Wow. A script that automates every aspect of the post-install process. *Thumbs Any chance that you could be persuaded to post this script, and explain how you built it up.
     
Thema:

Correct way to run scripts in automated, unattended Windows installation

Loading...
  1. Correct way to run scripts in automated, unattended Windows installation - Similar Threads - Correct run scripts

  2. Error when running script for automated emails in Windows Server 2016

    in Windows 10 Software and Apps
    Error when running script for automated emails in Windows Server 2016: This is on Windows Server 2016. Running on PowerShell version 5.1.14393.4583. It was working before. No changes were made to the script or the server. Suddenly the script throws the following error message:Exception calling "Send" with "1" arguments: "Failure sending mail."...
  3. Need partitioning script for unattended install

    in Windows 10 Installation and Upgrade
    Need partitioning script for unattended install: Hi I already have a working answer file but it works with wiping/formatting the whole disk. Can't figure out how to do this without wiping the disk, it would be useful for friends[remote ones] who like to clean install without interaction. (if one has important files on a...
  4. Is there a way to disable the security precaution that prevents automated scripts from...

    in Windows 10 Ask Insider
    Is there a way to disable the security precaution that prevents automated scripts from...: I'm currently using python pynput in order to simulate key presses. While the computer is unlocked it works perfectly however after i lock the computer, it doesn't work at all and I know that windows does this in order to prevent hacks and things like that but I'm wondering...
  5. Is there a way to disable the security precaution that prevents automated scripts from...

    in AntiVirus, Firewalls and System Security
    Is there a way to disable the security precaution that prevents automated scripts from...: I'm currently using python pynput in order to stimulate key presses. While the computer is unlocked it works perfectly however after i lock the computer, it doesn't work at all and I know that windows does this in order to prevent hacks and things like that but I'm wondering...
  6. WDS - configuring the unattended install correctly

    in Windows 10 Installation and Upgrade
    WDS - configuring the unattended install correctly: Hi Everyone, I have been struggling trying to get this going now and I have been working on this for about a month now (on and off) with little progress. My goals for the unattended install are as follows: - not have to enter admin credentials to proceed with the install -...
  7. Create media for automated unattended install of Windows 10

    in Windows 10 Installation and Upgrade
    Create media for automated unattended install of Windows 10: Followed Kari's excellent tut - Create media for automated unattended install of Windows 10 WSIM Getting the following Answer File Validation problem: The setting has not been modified. It will not be saved to the answerfile....
  8. Create media for automated unattended install of Windows 10

    in Windows 10 Support
    Create media for automated unattended install of Windows 10: Followed Kari's excellent tut - Create media for automated unattended install of Windows 10 WSIM Getting the following Answer File Validation problem: The setting has not been modified. It will not be saved to the answerfile....
  9. Another way of unattended PXE installation -- and it works :-)

    in Windows 10 Installation and Upgrade
    Another way of unattended PXE installation -- and it works :-): I had a run on the preview 10240 by unattended installation. what I wanted to see is if I could create a golden image on one very old PC (HP Elitebook 6930p), sysprep it and afterwards apply that image by autoupdating the drivers to my Dell Latitude E5540 before login. The...
  10. Create media for automated unattended install of Windows 10

    in Windows 10 Tutorials
    Create media for automated unattended install of Windows 10: How to: Create media for automated unattended install of Windows 10 [img] Information Installing Windows 10 is done in three phases: Boot from install media, run Windows Setup Configure hardware devices Windows Welcome (OOBE) In normal install, user interaction is...

Users found this page by searching for:

  1. windows unattend run script automatically

    ,
  2. how to change oem automated unattended