Forum Discussion

Ashish_Arya's avatar
Ashish_Arya
Brass Contributor
Aug 13, 2024

Parameter is incorrect error at ESP phase of Autopilot device preparation policy (Autopilot V2)

Hi Team,

 

I am testing the Windows autopilot device preparation profile (Autopilot V2).

Here, I need to rename the device while it is enrolling to the Intune (during ESP). So, I created a script that has below command to rename the device and rebooting it.

 
Rename-Computer -NewName $newname -ErrorAction 'Stop' -ErrorVariable err -Restart -Force
 
The issue I am facing now is that, when the device is at ESP, it runs the script to rename the device and also it restart the device. But after restart it does not complete the device preparation set up and s an shows an error screen called  with message "Parameter is incorrect" and after clicking on OK, I get to see the login screen. After logging in, I am able to use my machine fine and the device is also renamed as per my organization standards.
 
Does anyone also have faced this kind of issue while testing the Autopilot V2 with reboot script at ESP.
 
Regards,
Ashish Arya
 
  • Ankido's avatar
    Ankido
    Iron Contributor

    Ashish_Arya,

     

    Timing and ESP’s Dependency on Continuity


    The ESP (Enrollment Status Page) is designed to monitor and ensure that all configuration steps (Device Preparation, Device Setup, and Account Setup) are completed without interruption. When you force a restart using -Restart -Force in the script during the ESP phase, you disrupt the expected flow of ESP. After the restart, it appears that ESP cannot properly resume the process, which may cause the error. Autopilot V2 is sensitive to unexpected restarts, especially if they are not managed by Intune itself.

    Intune and Autopilot V2’s Handling of Restarts
    In Autopilot V2 (Device Preparation), restarts during ESP are not always fully supported unless they are initiated by Intune based on specific return codes from apps or scripts. Your script uses -Restart -Force, which means the restart happens immediately without giving Intune a chance to "approve" or manage it. This can result in ESP losing track of the process.

    Avoid Restart During ESP
    Test removing -Restart -Force from the script and allow the name change to occur without an immediate restart. The user can then manually restart the device after ESP is complete, or you can schedule the restart after ESP using another method (e.g., a scheduled task triggered after defaultuser0 logs out). This can help preserve ESP’s flow.

    Example of a modified script without restart:

    $newname = "YourDeviceName"
    Rename-Computer -NewName $newname -ErrorAction 'Stop' -ErrorVariable err

    Check Intune Configuration
    Ensure that your Device Preparation policy in Intune is correctly configured and that the script is marked as "Required" during the ESP phase. If there are any conflicting policies (e.g., one that also tries to set the device name), it could cause issues.

     

    Feel free to reach out.

  • jfagan970's avatar
    jfagan970
    Copper Contributor

    I'm also having this issue, though we do our renaming through a Remediation instead of a script that runs during provisioning. Everything about the setup works fine, but after the "Parameter is incorrect" screen, the user isn't being logged in automatically like in previous deployments with Device Preparation. We hadn't noticed this issue until we started deploying machines with Win11 24H2 installed, so that may be playing a factor. Any advice on how to fix this would be greatly appreciated, for OP and myself!

Resources