Forum Discussion
deep_gagan
Apr 04, 2022Copper Contributor
enroll azure ad joined devices into intune without user intervention and manual settings
Hi, is there any possibility to enroll azure ad joined devices into Intune without any user intervention and manually setting. Suppose there are 1000 azure ad joined devices on remote location, how c...
Apr 06, 2022
Anything in the device management logs?
What happens when running C:\Windows\system32\deviceenroller.exe /c /AutoEnrollMDM as system?
What happens when running C:\Windows\system32\deviceenroller.exe /c /AutoEnrollMDM as system?
deep_gagan
Apr 06, 2022Copper Contributor
last log is giving this message "Should show EnrollmentStatusPage result. Device: (0x0) Result (0x0)." with event id 85.
and till now I didn't run this ( C:\Windows\system32\deviceenroller.exe /c /AutoEnrollMDM ) command because I wanted to test that PowerShell script so that I can execute that remotely.
And I also wanted to know about this content. Is it also the content of PowerShell script ? then I would try this script .
$EnrollmentsPath = "HKLM:\SOFTWARE\Microsoft\Enrollments\"
$Enrollments = Get-ChildItem -Path $EnrollmentsPath
$DiscoveryServerFullUrls = @("https://wip.mam.manage.microsoft.com/Enroll")
Foreach ($Enrollment in $Enrollments) {
$EnrollmentObject = Get-ItemProperty Registry::$Enrollment
if ($EnrollmentObject."DiscoveryServiceFullURL" -in $DiscoveryServerFullUrls ) {
$EnrollmentPath = $EnrollmentsPath + $EnrollmentObject."PSChildName"
Remove-Item -Path $EnrollmentPath -Recurse
& "C:\Windows\System32\deviceenroller.exe /c /AutoEnrollMDM"
}
}
Thanks,
Gagandeep Singh
and till now I didn't run this ( C:\Windows\system32\deviceenroller.exe /c /AutoEnrollMDM ) command because I wanted to test that PowerShell script so that I can execute that remotely.
And I also wanted to know about this content. Is it also the content of PowerShell script ? then I would try this script .
$EnrollmentsPath = "HKLM:\SOFTWARE\Microsoft\Enrollments\"
$Enrollments = Get-ChildItem -Path $EnrollmentsPath
$DiscoveryServerFullUrls = @("https://wip.mam.manage.microsoft.com/Enroll")
Foreach ($Enrollment in $Enrollments) {
$EnrollmentObject = Get-ItemProperty Registry::$Enrollment
if ($EnrollmentObject."DiscoveryServiceFullURL" -in $DiscoveryServerFullUrls ) {
$EnrollmentPath = $EnrollmentsPath + $EnrollmentObject."PSChildName"
Remove-Item -Path $EnrollmentPath -Recurse
& "C:\Windows\System32\deviceenroller.exe /c /AutoEnrollMDM"
}
}
Thanks,
Gagandeep Singh