I’m using
$Devices = Get-MgDevice to get the devices from Azure with Graph
$autopilot = Get-MgDeviceManagementWindowsAutopilotDeviceIdentity to get all the autopilot devices
I wish to remove the $autopilot devices from $Devices and I have an $autopilot.AzureActiveDirectoryDeviceId which I can match to an Id/DeviceId (one of those anyway) in the $Devices.
I could loop through $Devices and compare to each $autopilot for the value but I was wondering if there was something a bit more efficient to do the same.
I’ve seen some $listA = $listA |Where-Object { $listB -notcontains $_.somevalue } stuff but can’t seem to find any examples where it’s a bit more complex referencing object values. So I’m not sure if I’m struggling with syntax or functionality
Xrai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.