Difference between revisions of "PowerShell Script Deployment via Intune"

From Notes_Wiki
 
 
Line 1: Line 1:
[[Main Page | Home]] > [[Microsoft Intune]] > [[PowerShell Script Deployment via Intune]]
[[Main Page | Home]] > [[Microsoft Intune]] > [[PowerShell Script Deployment via Intune]]


= PowerShell Script Deployment via Intune =
 
== Overview ==
This guide explains how to deploy PowerShell scripts to managed Windows devices using Microsoft Intune. 
Example: Creating a folder (C:\CompanyData) on all targeted machines.
 
== Prerequisites ==
* Intune Administrator or Global Administrator role.
* Devices must be Intune-enrolled.
* Tested PowerShell script (.ps1).
 
== Steps ==
 
=== 1. Sign in ===
* Open [https://endpoint.microsoft.com Microsoft Intune Admin Center].
* Log in with administrator credentials.
 
=== 2. Navigate to Scripts ===
* Go to: '''Devices > Scripts > Add > Windows 10 and later'''.
 
=== 3. Add Script ===
* Provide:
** '''Name:''' Folder Creation Script
** '''Description:''' Creates folder C:\CompanyData
 
=== 4. Upload Script ===
* Click '''Browse''' and upload the .ps1 file.
* Example script:
  <source lang="powershell">
  New-Item -ItemType Directory -Path "C:\CompanyData" -Force
  </source>
 
=== 5. Configure Script Settings ===
* Options:
** Run this script using the logged-on credentials: Yes/No
** Enforce script signature check: No (unless signed)
** Run script in 64-bit PowerShell host: Yes
 
=== 6. Assign the Script ===
* Add Azure AD groups:
** All Devices
** Specific departments
* Define assignment scope.
 
=== 7. Review and Add ===
* Review summary.
* Click '''Add''' to deploy.
 
=== 8. Monitor Deployment ===
* Navigate: '''Devices > Scripts > Select Script > Device status/User status'''.
* Review results and troubleshoot failures.
 
== Notes ==
* PowerShell scripts run once unless re-applied.
* For recurring enforcement, use '''Proactive Remediations''' in Endpoint Analytics.
* Always test scripts before deploying at scale.
 




[[Main Page | Home]] > [[Microsoft Intune]] > [[PowerShell Script Deployment via Intune]]
[[Main Page | Home]] > [[Microsoft Intune]] > [[PowerShell Script Deployment via Intune]]

Latest revision as of 07:21, 4 September 2025

Home > Microsoft Intune > PowerShell Script Deployment via Intune

PowerShell Script Deployment via Intune

Overview

This guide explains how to deploy PowerShell scripts to managed Windows devices using Microsoft Intune. Example: Creating a folder (C:\CompanyData) on all targeted machines.

Prerequisites

  • Intune Administrator or Global Administrator role.
  • Devices must be Intune-enrolled.
  • Tested PowerShell script (.ps1).

Steps

1. Sign in

2. Navigate to Scripts

  • Go to: Devices > Scripts > Add > Windows 10 and later.

3. Add Script

  • Provide:
    • Name: Folder Creation Script
    • Description: Creates folder C:\CompanyData

4. Upload Script

  • Click Browse and upload the .ps1 file.
  • Example script:
  New-Item -ItemType Directory -Path "C:\CompanyData" -Force

5. Configure Script Settings

  • Options:
    • Run this script using the logged-on credentials: Yes/No
    • Enforce script signature check: No (unless signed)
    • Run script in 64-bit PowerShell host: Yes

6. Assign the Script

  • Add Azure AD groups:
    • All Devices
    • Specific departments
  • Define assignment scope.

7. Review and Add

  • Review summary.
  • Click Add to deploy.

8. Monitor Deployment

  • Navigate: Devices > Scripts > Select Script > Device status/User status.
  • Review results and troubleshoot failures.

Notes

  • PowerShell scripts run once unless re-applied.
  • For recurring enforcement, use Proactive Remediations in Endpoint Analytics.
  • Always test scripts before deploying at scale.


Home > Microsoft Intune > PowerShell Script Deployment via Intune