Re-Enroll Windows device without app uninstallation

If you want to quickly re-enroll a Windows device you’ll see that managed applications getting uninstalled. Also some configurations are left on the device.
Note : This is not possible for Windows Azure AD Premium joined devices.

I created a script to clean up all the left overs and to re-install + re-enroll the HUB.
You can find the script HERE.

You need to run PowerShell as administrator and run the following command:

reenroll.ps1 -KeepAppsInstalled True -Reenrolldevice True -DSServerURL "" -UserName "StagingUser" -UserPassword "StagingPassword" -OGID "570" 
  • KeepAppsInstalled
    If set to “True”, it will uninstall the SFD agent first – this will prevent the uninstallation of the app.
  • Reenrolldevice
    If you want to automatically re-enroll the device, select “True”
  • DSServerURL
    Device Server URL is needed to download the HUB and enroll the device with the staging user
  • UserName
    Staging user name
  • UserPassword
    Staging user password
  • OGID
    Target OG where the device should be joined

2 thoughts on “Re-Enroll Windows device without app uninstallation

  • Fabian
    2022-10-14 at 14:05

    First, thank you for the script. Could come in handy.
    For environments with assist something has to be added to the “#Uninstall Agent […]” Part, as this grabs two ID`s. One for the Workspace One Hub and on for the Workspace One Assist app. With that added the script works great.

    • Grischa Ernst
      2022-10-18 at 06:54

      Good point – thanks for the hint.
      I’ll check this and update the script!

Leave a Reply

Your email address will not be published. Required fields are marked *.

You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

BCF Shop Theme By aThemeArt.