Trying to run script to configure firewall in intune

Hyugai 1 Reputation point
2022-09-30T02:11:16.19+00:00

i am trying to run some powershell script to configure my firewall config in intune.

246266-firewallrule1.jpg

246302-firewallrule2.jpg

246321-firewallrule3.jpg

However, after waiting for 1 days, the deployment (as you can see from pic3) still showing 0 device status.
Am i missing something? How come the script does not get deployed to the windows computer? and i also check on the targeted windows computer, under c:\windows\temp, there is no log recorded in there (on my powershell, i script it so that i create and record logs in C:\Windows\Temp)

Windows for business | Windows Client for IT Pros | Devices and deployment | Configure application groups
Microsoft Security | Intune | Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Lu Dai-MSFT 28,496 Reputation points
    2022-09-30T05:45:15.033+00:00

    @Hyugai Thanks for posting in our Q&A.

    For this issue, please make sure Microsoft Intune management extension is installed and Microsoft Intune management service is running.

    Then we can refer to the following link to deep dive this issue:
    https://oliverkieselbach.com/2017/11/29/deep-dive-microsoft-intune-management-extension-powershell-scripts/
    Note: Non-Microsoft link, just for the reference.

    If there is anything update, feel free to let us know.


    If the answer is the right solution, 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.

    0 comments No comments

  2. Hyugai 1 Reputation point
    2022-10-02T07:59:06.593+00:00

    actually, it now return failed246741-firewallscriptresult1.jpg

    Can anyone help me on how do i troubleshoot why my script is failing?

    0 comments No comments

  3. Limitless Technology 44,751 Reputation points
    2022-10-03T07:49:18.147+00:00

    Hello there,

    An invalid file path specified on a firewall rule will lead to policy processing errors. As an example, having a typo in an environment variable, such as an extra space in %ProgramFiles(x86)% will lead to an entire policy being reported as failed. The Windows Firewall client only supports built-in Windows environment variables, which can cause other file path issues. Custom variables, even if valid, cannot be used.

    Here is a link that has some additional troubleshooting steps which you can try and see if helps in overcoming your issue

    How to trace and troubleshoot the Intune Endpoint Security Firewall rule creation process https://techcommunity.microsoft.com/t5/intune-customer-success/how-to-trace-and-troubleshoot-the-intune-endpoint-security/ba-p/3261452

    Create Windows Firewall rules in Intune https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-firewall/create-windows-firewall-rules-in-intune

    ------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

  4. Hyugai 1 Reputation point
    2022-10-07T00:03:17.327+00:00

    Hi All,
    i tried to redeploy the script again to different test group, and this time after 3 days it update the result to be error.
    However, when i go to the device, the firewall change was successfull and i checked c:\windows\temp for my script log and below are the log.
    can anyone help me? why is my script running perfectly but according to intune it shows error.


  5. Hyugai 1 Reputation point
    2022-10-07T00:03:43.507+00:00

    248323-scriptlog.jpg

    0 comments No comments

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.