I am looking to use Powershell to bulk remove AAD / Intune and AutoPilot devices.

Question

I have looked at: https://smsagent.blog/2020/03/17/delete-device-records-in-ad-aad-intune-autopilot-configmgr-with-powershell/

and

Need to delete specific 200 devices from Intune

 

And but I am unsure exactly where to use:
$computer_list = Import-Csv “C:tempScript_test.csv”
foreach ($computer in $computer_list)
{
.Delete-AutopilotedDeviceRecords.ps1 -ComputerName $($computer.ComputerName) -Intune
}

As I also wish to delete AAD devices I would look to use the command:

Remove-AzureADDevice -ComputerName $($computer.ComputerName)

your expertise would be greatly appreciated

in progress 0
DClarkie 2021-10-22T13:43:22+05:30 1 Answer 170 views Beginner 0

Answer ( 1 )

  1. I think it’s better to contact the owner of the script to get more details on this topic. I normally the following should work?

    I think you just need to use below script.

    $computer_list = Import-Csv “C:\temp\Script_test.csv”
    foreach ($computer in $computer_list)
    {
    .\Delete-AutopilotedDeviceRecords.ps1 -ComputerName $($computer.ComputerName) -Intune
    }

Leave an answer

Sorry, you do not have a permission to answer to this question .