Not every company uses Microsoft Intune or System Center, but this does not mean that tools such as Microsoft Defender for Endpoint cannot be used. Only the distribution of the corresponding onboarding packages is not necessarily as simple as when, for example, Microsoft Intune is in use.

Many tasks have to be done manually. To make onboarding easier, however, I have written a small script for this purpose, which I would like to present to you here.

Before we can start with it, however, some tasks have to be prepared:


  • Go to the Microsoft 365 Defender portal (, and sign in.
  • In the navigation pane, choose Settings > Endpoints, and then under Device management, choose Onboarding.
  • Select an operating system, such as Windows 10 or 11, and then, in the Deployment method section, choose Local script.
  • Select Download onboarding package

(More information about that task you can find here.)


When executing the script, the first thing to do is to specify the network path where the ZIP file is located, which was first created and downloaded by Microsoft.
The next step is to check whether a corresponding SUB directory exists where the ZIP file can be downloaded. If this directory does not exist, it is created at this point.
Now the ZIP file is downloaded from the file share.
In the next step, the ZIP file will be decompressed.
At this point in the script we can now decide whether we want to execute the onboarding process automatically or manually. If the PowerShell console has been executed as an administrator, you can select the automatic option here without any problems.


Otherwise, it is recommended to select the manual option.

If the manual option is selected, a subfolder will be created and the corresponding CMD file will be copied to it.
After this process is completed, the corresponding window opens automatically and the CMD is ready to be executed. It is important to note, however, that the CMD script must be executed with elevated permissions.
However, if the automatic option was selected, the onboarding process will now start.


You can download my PowerShell script as usual on my

GitHub Repositpry

for free. I hope this script can support you in your daily work.