OSDeploy / OSD

OSD Shared Functions
MIT License
132 stars 54 forks source link

Shutdown after First Boot / before OOBE starts #96

Closed NorbertBauer closed 6 months ago

NorbertBauer commented 7 months ago

May I have not found the option, but it would be great to have the possibility to prepare Devices and shutdown after first boot. So it would be easier to have devices preinstalled and only the Autopilot will need to run, after Windows and drivers are already finished and the device is shipped to the enduser in a similar state, as it would be from factory.

I am not sure, if the process works by using the audit mode for the installation of drivers and the last command is "sysprep /oobe". But if so, then it would be great to have the option to add the "shutdown" parameter to the sysprep command, instead of the default "reboot" parameter.

gwblok commented 6 months ago

So basically you're asking, after everything is complete, and it's sitting at the OOBE screen, that it would just shutdown?

NorbertBauer commented 6 months ago

Yes. After that, it will be sent to User and he should finish the one.

Abe-Telo commented 6 months ago

I run a script that automatically connects to Wi-Fi, which I believe is during driver installation. This script functions simultaneously with the driver installation. To implement this, you need to create a .ppkg file and place it in OSDCloud/Automate/Provisioning/whatever.ppkg. Using a command like "shutdown -s -t 120" could be effective for this. You might want to add a pause to ensure it works correctly on the first test.

https://www.osdcloud.com/osdcloud-automate/provisioning/msi-application-ppkg

You also have the option to create an Autounattend.xml file. This file enables you to add a command that triggers the execution of scripts when a user logs in for the first time.

What i usually do, is press Ctr, Shift F3 in OOBE, after testing PC, i Select Enter System Out of box experience. and click Shutdown.

gwblok commented 6 months ago

I've built and tested this functionality in "test", and it's working well. Basically, you set a variable, and it will shutdown the device at the end of SetupComplete stage.

ShutdownSetupComplete = [bool]$true

You can look at this sample script on how to preset OSDCloud Variables and trigger OSDCloud https://github.com/gwblok/garytown/blob/master/Dev/CloudScripts/SettingOSDCloudVarsSample.ps1

This update should be in the next release of OSDCloud Module

gwblok commented 6 months ago

This is now included in Module 24.1.3.1 Set the variable before you start OSDCloud, and it will shutdown at the end of Setup Complete, so when you turn it on, it starts right at the OOBE screen for "is this the right country or region?"

ShutdownSetupComplete = [bool]$true

See previous comment for examples to use.