Categories: Kali Linux

PSMDATP : PowerShell Module For Managing Microsoft Defender Advanced Threat Protection

Welcome to the Microsoft Defender Advanced Threat Protection PowerShell module: PSMDATP

This module is a collection of easy-to-use cmdlets and functions designed to make it easy to interface with the Microsoft Defender Advanced Threat Protection API.

Motivation

I created this PowerShell module for MDATP for the following reasons:

  1. Advance my PowerShell skills
  2. Provide an easy way to interact with MDATP through PowerShell because I prefer automation over manual tasks

Prerequisites

  • Windows PowerShell 5.1 (Testing for PowerShell 7 is in progress)
  • have configured authorization for access by registering an application in AzureAD

App Permissions

Below is an example of the App Permissions that you must grant. I will provide more details soon about the individual cmdlets and the permissions required

Getting Started

To get started with the module, open your PowerShell terminal and install the module from the PSGallery by running this simple command:

Install-Module PSMDATP -Scope CurrentUser

App Registration

Initial Configuration

When you have installed the module and registered the App in AzureAD, you will find a file TEMPLATE_PoshMTPconfig.json in the Module folder. Rename this file to PoshMTPConfig.json and enter your API settings. Then copy the file in the root of the Module folder.

  • Example:
"C:\Users\User1\Documents\WindowsPowerShell\Modules\PSMDATP"
───PSMDATP
│   │   PoshMTPconfig.json
│   │
│   └───0.0.2
│           PSMDATP.psd1
│           PSMDATP.psm1
│           TEMPLATE_PoshMTPconfig.json

At present the PSMDATP PowerShell module only requires the API_MDATP information

{
    "API_MDATP":  {
                      "AppName":  "WindowsDefenderATPPSMDATP",
                      "OAuthUri":  "https://login.windows.net/<YOUR TENANT ID>/oauth2/token",
                      "ClientID":  "CLIENT ID",
                      "ClientSecret":  "<CLIENT SECRET>"
                  },
    "API_MSGRAPH":  {
                        "AppName":  "xMSGraph",
                        "OAuthUri":  "https://login.windows.net/<YOUR TENANT ID>/oauth2/token",
                        "ClientID":  "<CLIENT ID>",
                        "ClientSecret":  "<CLIENT SECRET>"
                    }
}

Important

I am going to assume that you are familiar with MDATP as such and understand the consequences of triggering actions on devices. Where applicable the cmdlets support the use the -whatif parameter. Think before pressing the key!

Running Your First Commands

  • List included cmdlets

Let’s first take a look at the cmdlets included in the PSMDATP Module

get-command -Module PSMDATP | Select Name

You will see something like this

Add-MDATPDeviceTag
Add-MDATPIndicator{
Get-MDATPAlert
Get-MDATPCollectionPackageUri
Get-MDATPDevice
Get-MDATPDeviceAction
Get-MDATPDeviceTag
Get-MDATPIndicator
Get-MDATPInvestigation
Get-MDATPQuery
Get-MDATPTvmRecommendation
Get-MDATPTvmVulnerability
Remove-MDATPDevice
Remove-MDATPDeviceTag
Remove-MDATPIndicator
Start-MDATPAppRestriction
Start-MDATPAVScan
Start-MDATPInvestigation
Start-MDATPInvestigationPackageCollection
Start-MDATPIsolation
Stop-MDATPAppRestriction
Stop-MDATPIsolation

For more details about the cmdlets included in this module check out the cmdlets documentation page

  • Retrieve MDATP Alerts

Run the following command to retrieve alerts from the past 30 days

Get-MDATPAlert -PastHours 720

  • List MDATP Devices

Run the following command to list all MDATP registered devices

Get-MDATPDevice -All

R K

Recent Posts

UEFITool / UEFIExtract / UEFIFind NE A70 : A Major Release

The latest version of UEFITool / UEFIExtract / UEFIFind, labeled as NE A70, marks a…

18 hours ago

Portfolio As A Software Developer Using React And Vite

Creating a professional portfolio as a software developer is crucial for showcasing skills and projects…

18 hours ago

uBlock Origin And uBlacklist Huge AI Blocklist : Tools For A Cleaner Search Experience

In the era of AI-generated content, maintaining authenticity in search results has become increasingly challenging.…

18 hours ago

Web-Check : The Comprehensive Tool For Website Analysis And Optimization

Web-Check is a powerful, open-source tool designed to provide comprehensive insights into a website's underlying…

18 hours ago

Fcuk : Fuzzy CUDA Kernel

Fcuk, or Fuzzy CUDA Kernel, is an innovative library designed to leverage the power of…

18 hours ago

CVE-2025-24813-PoC : Apache Tomcat 远程代码执行漏洞批量检测脚本

简介 CVE-2025-24813 是一个影响 Apache Tomcat 的远程代码执行(RCE)漏洞,允许攻击者通过发送一个 PUT 请求上传恶意的序列化会话文件,并通过 GET 请求触发反序列化,从而在服务器上执行任意代码。该漏洞已在野外被利用,且其利用条件相对简单,只需 Tomcat 使用文件存储会话且支持部分 PUT 请求即可。 脚本功能…

22 hours ago