How to configure the PowerShell script for Intune Devices | Scripts execution?

EnterpriseArchitect 5,336 Reputation points
2023-11-27T01:01:54.8133333+00:00

Hi All,

I need some help and guidance on how to allow the PowerShell script to run when it is uploaded via the Intune portal: https://intune.microsoft.com/#view/Microsoft_Intune_DeviceSettings/DevicesMenu/~/powershell ?

The actual script when I execute it on my laptop must be Run as Administrator and then I must issue the following:

Set-ExecutionPolicy Unrestricted

Any help would be greatly appreciated.

Microsoft Intune Security
Microsoft Intune Security
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
412 questions
Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
1,885 questions
Microsoft Intune Application management
Microsoft Intune Application management
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Application management: The process of creating, configuring, managing, and monitoring applications.
938 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,988 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,466 questions
0 comments No comments
{count} votes

Accepted answer
  1. JatinMakhija 971 Reputation points
    2023-11-27T08:08:21.8666667+00:00

    If you want to execute a Powershell script as an administrator then you should select "Run this script using the logged on credentials" to No while creating a Powershell script deployment from Intune admin center.

    Refer to this link for more detailed information: https://cloudinfra.net/how-to-deploy-a-powershell-script-using-intune/

    --If the response is helpful, please click "Accept Answer" and upvote it.--

    4 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. ZhoumingDuan-MSFT 12,580 Reputation points Microsoft Vendor
    2023-11-27T01:47:42.36+00:00

    @EnterpriseArchitect,Thanks for posting in Q&A.

    From your description, I know that you want to know how to run the PowerShell script when it is uploaded into Intune.

    Based on my research, there are some official documents to guide you how to configure PowerShell script.

    https://video2.skills-academy.com/en-us/mem/intune/apps/intune-management-extension --Windows 10/11

    https://video2.skills-academy.com/en-us/mem/intune/apps/macos-shell-scripts --macOS

    Hope this can be helpful. If there is any update, feel free to contact me.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.