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
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
Answer ( 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
}