microsoft / Intune-PowerShell-SDK

Native PowerShell support for invoking Microsoft Intune Graph API to enable IT Pro scenario automation.
MIT License
314 stars 77 forks source link

MAC Address not available via SDK #75

Open clickbangdead opened 4 years ago

clickbangdead commented 4 years ago

In December, Intune added Ethernet MAC Address as a property (finally!). It's available via hardware properties in the portal, but if I retrieve devices using:

$a = Get-IntuneManagedDevice | Get-MSGraphAllPages

I get an empty ethernetMacAddress field on all devices. I am able to get the data if i directly query via REST like so:

$DeviceID = <some Device's ID>
$URI = [uri]::EscapeUriString("https://graph.microsoft.com/beta/deviceManagement/manageddevices('$deviceid')?`$select=UserPrincipalName,emailAddress,deviceName,model,manufacturer,serialNumber,id,lastSyncDateTime,ethernetMacAddress&_=1576515130721")
$dev = Invoke-MSGraphRequest -url $uri -HttpMethod get

Then i am able to get the ethernetMacAddress property

If I do:

Get-IntuneManagedDevice -Select id,ethernetMacAddress | Get-MSGraphAllPages I get:

Get-DeviceManagement_ManagedDevices : Cannot validate argument on parameter 'Select'. The argument "ethernetMacAddress" 
does not belong to the set "id,userId,deviceName,managedDeviceOwnerType,deviceActionResults,enrolledDateTime,lastSyncDateTim
e,operatingSystem,complianceState,jailBroken,managementAgent,osVersion,easActivated,easDeviceId,easActivationDateTime,azureA
DRegistered,deviceEnrollmentType,activationLockBypassCode,emailAddress,azureADDeviceId,deviceRegistrationState,deviceCategor
yDisplayName,isSupervised,exchangeLastSuccessfulSyncDateTime,exchangeAccessState,exchangeAccessStateReason,remoteAssistanceS
essionUrl,remoteAssistanceSessionErrorDetails,isEncrypted,userPrincipalName,model,manufacturer,imei,complianceGracePeriodExp
irationDateTime,serialNumber,phoneNumber,androidSecurityPatchLevel,userDisplayName,configurationManagerClientEnabledFeatures
,wiFiMacAddress,deviceHealthAttestationState,subscriberCarrier,meid,totalStorageSpaceInBytes,freeStorageSpaceInBytes,managed
DeviceName,partnerReportedThreatState,deviceConfigurationStates,deviceCategory,deviceCompliancePolicyStates" specified by 
the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:38
+ $a = Get-IntuneManagedDevice -Select id,ethernetMacAddress | Get-MSGr ...
+                                      ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-DeviceManagement_ManagedDevices], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.Get_De 
   viceManagement_ManagedDevices
0byt3 commented 3 years ago

I tried your example of

$DeviceID = <some Device's ID>
$URI = [uri]::EscapeUriString("https://graph.microsoft.com/beta/deviceManagement/manageddevices('$deviceid')?`$select=UserPrincipalName,emailAddress,deviceName,model,manufacturer,serialNumber,id,lastSyncDateTime,ethernetMacAddress&_=1576515130721")
$dev = Invoke-MSGraphRequest -url $uri -HttpMethod get

I get the error message: Parsing OData Select and Expand failed: Could not find a property named 'ethernetMacAddress' on type 'microsoft.graph.managedDevice'.

Are you sure this property exists?

ghost commented 3 years ago

I have hit this same issue today. Example:

$intuneDevices = Get-IntuneManagedDevice | Get-MSGraphAllPages $intuneDevices[0]

Returns an object with property (see below), but I receive the same error as @clickbangdead when using the select parameter with the property included. 2021-09-21_093936

Possibly that the set validation needs to be updated with the new property?

chrisnelmes commented 1 year ago

Hello, I am also experiencing this issue.

f22l2 commented 1 year ago

hi, do we have any update of this case?

abo-github commented 8 months ago

still same issue here