Onboard Windows devices using a local script
Applies to:
- Microsoft Defender for Endpoint Plan 1
- Microsoft Defender for Endpoint Plan 2
- Microsoft 365 Defender
Want to experience Defender for Endpoint? Sign up for a free trial.
You can also manually onboard individual devices to Defender for Endpoint. You might want to do this first when testing the service before you commit to onboarding all devices in your network.
Important
This script has been optimized for use on up to ten devices. Local scripting is a special onboarding method for evaluating Microsoft Defender for Endpoint. The data reporting frequency is set higher than with other onboarding methods when onboarding using a local script. This setting is for evaluation purposes and is not normally used in production deployments. For this reason, there are concerns about environmental impact, so we recommend limiting the number of deployments using local scripts to ten. If you are deploying to a production environment as previously described, use other deployment options like Group Policy or Microsoft Endpoint Configuration Manager.
Check out the PDF or Visio to see the various paths in deploying Defender for Endpoint.
Onboard devices
Open the GP configuration package .zip file (WindowsDefenderATPOnboardingPackage.zip) that you downloaded from the service onboarding wizard. You can also get the package from Microsoft 365 Defender portal:
- In the navigation pane, select Settings > Endpoints > Device management > Onboarding.
Check out the PDF or Visio to see the various paths in deploying Defender for Endpoint.
Open the GP configuration package .zip file (WindowsDefenderATPOnboardingPackage.zip) that you downloaded from the service onboarding wizard. You can also get the package from Microsoft 365 Defender portal:
- In the navigation pane, select Settings > Endpoints > Device management > Onboarding.
- Select Windows 10 or Windows 11 as the operating system.
- In the Deployment method field, select Local Script.
- Click Download package and save the .zip file.
Extract the contents of the configuration package to a location on the device you want to onboard (for example, the Desktop). You should have a file named WindowsDefenderATPLocalOnboardingScript.cmd.
Open an elevated command-line prompt on the device and run the script:
- Go to Start and type cmd.
- Right-click Command prompt and select Run as administrator.
Type the location of the script file. If you copied the file to the desktop, type: %userprofile%\Desktop\WindowsDefenderATPLocalOnboardingScript.cmd
Press the Enter key or click OK.
For information on how you can manually validate that the device is compliant and correctly reports sensor data see, Troubleshoot Microsoft Defender for Endpoint onboarding issues.
Tip
After onboarding the device, you can choose to run a detection test to verify that a device is properly onboarded to the service. For more information, see Run a detection test on a newly onboarded Microsoft Defender for Endpoint endpoint.
Configure sample collection settings
For each device, you can set a configuration value to state whether samples can be collected from the device when a request is made through Microsoft 365 Defender to submit a file for deep analysis.
You can manually configure the sample sharing setting on the device by using regedit or creating and running a .reg file.
The configuration is set through the following registry key entry:
Path: "HKLM\SOFTWARE\Policies\Microsoft\Windows Advanced Threat Protection"
Name: "AllowSampleCollection"
Value: 0 or 1
Where Name type is a D-WORD. Possible values are:
- 0 - doesn't allow sample sharing from this device
- 1 - allows sharing of all file types from this device
The default value in case the registry key doesn't exist is 1.
Run a detection test to verify onboarding
After onboarding the device, you can choose to run a detection test to verify that a device is properly onboarded to the service. For more information, see Run a detection test on a newly onboarded Microsoft Defender for Endpoint device.
Offboard devices using a local script
For security reasons, the package used to Offboard devices will expire 30 days after the date it was downloaded. Expired offboarding packages sent to a device will be rejected. When downloading an offboarding package you will be notified of the packages expiry date and it will also be included in the package name.
Note
Onboarding and offboarding policies must not be deployed on the same device at the same time, otherwise this will cause unpredictable collisions.
Get the offboarding package from Microsoft 365 Defender portal:
- In the navigation pane, select Settings > Endpoints > Device management > Offboarding.
- Select Windows 10 or Windows 11 as the operating system.
- In the Deployment method field, select Local Script.
- Click Download package and save the .zip file.
Extract the contents of the .zip file to a shared, read-only location that can be accessed by the devices. You should have a file named WindowsDefenderATPOffboardingScript_valid_until_YYYY-MM-DD.cmd.
Open an elevated command-line prompt on the device and run the script:
Type the location of the script file. If you copied the file to the desktop, type: %userprofile%\Desktop\WindowsDefenderATPOffboardingScript_valid_until_YYYY-MM-DD.cmd
Press the Enter key or click OK.
Important
Offboarding causes the device to stop sending sensor data to the portal but data from the device, including reference to any alerts it has had will be retained for up to 6 months.
Monitor device configuration
You can follow the different verification steps in the Troubleshoot onboarding issues to verify that the script completed successfully and the agent is running.
Monitoring can also be done directly on the portal, or by using the different deployment tools.
Monitor devices using the portal
- Go to Microsoft 365 Defender portal.
- Click Devices inventory.
- Verify that devices are appearing.
Related topics
- Onboard Windows devices using Group Policy
- Onboard Windows devices using Microsoft Endpoint Configuration Manager
- Onboard Windows devices using Mobile Device Management tools
- Onboard non-persistent virtual desktop infrastructure (VDI) devices
- Run a detection test on a newly onboarded Microsoft Defender for Endpoint device
- Troubleshoot Microsoft Defender for Endpoint onboarding issues
Comentarios
Enviar y ver comentarios de