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

EnterpriseArchitect 6,041 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.

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Intune | Security
Microsoft Security | Intune | Configuration
Microsoft Security | Intune | Application management
Microsoft Security | Intune | Other
0 comments No comments
{count} votes

Accepted answer
  1. JM 1,166 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 17,165 Reputation points Microsoft External Staff
    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://learn.microsoft.com/en-us/mem/intune/apps/intune-management-extension --Windows 10/11

    https://learn.microsoft.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.