Deploying Platform scripts
We will start with the original option, which has been available in Intune for longer than the rest. Platform scripts run once on the device and can run in the system or user context. By default, they run in 32-bit mode, but this can be changed on deployment. This is important to note as environmental variables will differ accordingly for both system/user and 32/64-bit.
To find out more about User/System targeting, go to https://andrewstaylor.com/2022/11/22/intune-comparing-system-vs-user-for-everything/.
When running during Autopilot, there is no labeled step where scripts run – they run when it says Preparing apps in User or Device setup. If you hit a time-out issue here, it is more than likely a failed PowerShell script that has not reported a success code in time.
To troubleshoot and view the output of a script, retrieve the script ID from the address bar in the Intune portal. The output will be in the following location under a subkey...