---
title: "Discussion on \"Fixing Windows clients Intune automatic enrollment issues using PowerShell\" | Hashnode"
description: "Discussion on \"Fixing Windows clients Intune automatic enrollment issues using PowerShell\". If you are using automatic enrollment of your clients to Intune (via GPO or SCCM), you've probably encountered a situation when some of the clients failed to enroll. You could find this out by accident or by using my Intune clients report.\nAnd I am t..."
url: "https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Fixing Windows clients Intune automatic enrollment issues using PowerShell](https://doitpshway.com/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell?utm_source=hashnode&utm_medium=feed)

If you are using automatic enrollment of your clients to Intune (via GPO or SCCM), you've probably encountered a situation when some of the clients failed to enroll. You could find this out by accident or by using my Intune clients report. And I am t...

Oct 13, 2021 · 2 min read · doitpshway.com  
Read the article

-   [#powershell](https://hashnode.com/tag/powershell)
-   [#windows](https://hashnode.com/tag/windows)
-   [#azure](https://hashnode.com/tag/azure)

## Written by

[Ondrej Sebela](https://hashnode.com/@AndrewZtrhgf)

@AndrewZtrhgf · Czech Republic

  
[View profile](https://hashnode.com/@AndrewZtrhgf)

System Administrator that loves PowerShell

I work as System Administrator for more than 15 years now and I love to make my life easier by automating work &amp; personal stuff via PowerShell (even silly things like food recipes list generation).

## Responses 2

Markdown supported · ⌘↵ to post

[Jeremy Pridgen](https://hashnode.com/@jbpridgen)

[Jul 26, 2022](https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941/comment/62e038987d25049e8097622a)

Hello!

When trying to run the process on an existing machine I'm able to run the process and get to where it's waiting for the intune cert, but it's unsure if it can be found

Then it fails to run the AgentExecutor.log - any thoughts on why it errors here? - note: this is being run on a machine already enrolled into intune - Had images for reference, but unable to attach

I tried to re-run again and it wasn't able to find the guid from the task scheduler

Also tried on another machine and got the same error

[Ondrej Sebela](https://hashnode.com/@AndrewZtrhgf)

[Jul 26, 2022](https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941/comment/62e038987d25049e8097622a#reply-62e045a47d25049e809763f6)

Hi, something in the enrollment process was changed maybe...I luckily wasn't in need to use this function for a long time. DM me on Twitter [twitter.com/AndrewZtrhgf](https://twitter.com/AndrewZtrhgf) with the screenshots. Maybe we will find solution to this.

[Andrew Johnson](https://hashnode.com/@Chidrewskee27)

[May 25, 2022](https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941/comment/628dc59ebc26026fa45c5cdf)

Hello, this script seems to be exactly what I'm looking for. I am having issues with the Invoke-InTuneReenrollment portion. That's the only part that I need for what I'm working on. What modules do I need for this part only?

[Ondrej Sebela](https://hashnode.com/@AndrewZtrhgf)

[May 25, 2022](https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941/comment/628dc59ebc26026fa45c5cdf#reply-628dc9cbbc26026fa45c5d67)

Not sure what you are asking? Anyway internally Invoke-InTuneReenrollment uses function Invoke-AsSystem which is defined in Reset-HybridADJoin function.

If this is not the case, send me the screenshot with the error you are facing.

[Andrew Johnson](https://hashnode.com/@Chidrewskee27)

[May 25, 2022](https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941/comment/628dc59ebc26026fa45c5cdf#reply-628dcf1ab4bd016fc9a33323)

I meant that when I try to run just the Invoke-MDMReenrollment ps1, it does nothing. No error message. Just nothing. Do I need any certain Powershell modules installed?

[Ondrej Sebela](https://hashnode.com/@AndrewZtrhgf)

[Ondrej Sebela](https://hashnode.com/@AndrewZtrhgf)

[Jun 23, 2022](https://hashnode.com/posts/fixing-windows-clients-intune-automatic-enrollment-issues-using-powershell/616727fc53401f641ba15941/comment/628dc59ebc26026fa45c5cdf#reply-62b4bdb8b86f939ac81b121c)

[Andrew Johnson](https://hashnode.com/@Chidrewskee27) You have to dot source the ps1 script file and then call a function that it defines, which is Invoke-MDMReenrollment.
