How to collect custom inventory from Azure AD Joined devices

Published Apr 22 2021 09:01 AM 4,982 Views
Microsoft

Kubilay Dagdelen on my team worked with several other folks to pull together a method for doing some custom inventory collection with Intune.  There are some performance delays that can be encountered if over-used, but it can be handy at times.

 

ConfigMgr admins love extending hardware inventory and collecting data from Windows devices.
Did you know Intune can do the same?!
The answer is Intune PowerShell scripts! Also known as SideCar… IME… Intune Management Extensions…

Well, IME is just another channel that runs parallel to MDM that sort of acts like the ConfigMgr client. We deliver different features over this channel: PowerShell scripts, Win32 apps, Proactive Remediation scripts, Win32 app log collection…


Can you give us an example?
Maybe you are interested to know more about Win32_BIOS.
Run the following PowerShell one-liner on a device

 

 

 

Get-WmiObject -Class Win32_BIOS |
select CurrentLanguage,
Description,
EmbeddedControllerMajorVersion,
EmbeddedControllerMinorVersion,
Manufacturer,
ReleaseDate,
SerialNumber | ConvertTo-Json -Compress

 

 


Script outputs the following:

MikeGriz_0-1619043818972.png

 

Beautified:

 

 

{
"CurrentLanguage": "en-US",
"Description": "N2EET43W (1.25 )",
"EmbeddedControllerMajorVersion": 1,
"EmbeddedControllerMinorVersion": 13,
"Manufacturer": "LENOVO",
"ReleaseDate": "20191028000000.000000+000",
"SerialNumber": "12345678"
}

 

 


Let’s create an Intune PowerShell script and deploy it to some users/devices to demonstrate Win32_BIOS data as an example.

MikeGriz_2-1619043913367.png


Tip: <scriptId> is stored in the URL

MikeGriz_3-1619043946125.png


You can access the data via the following Graph endpoint in graph explorer
https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/<scriptID>/deviceRunStates...

 

It turns out that we store the above-mentioned script output in a property on the service side. If you are familiar with Graph Explorer, then you can take a look at the results


In the property “resultMessage”:

MikeGriz_4-1619043988087.png


How do I see the data from all devices?
Prerequisites:
Install-Module -Name Microsoft.Graph.Intune


You need one more script to retrieve your results from Graph…

 

 

Update-MSGraphEnvironment -SchemaVersion 'beta'
Connect-MSGraph

$result = Invoke-MSGraphRequest -HttpMethod GET -Url 'deviceManagement/deviceManagementScripts/b113448a-528a-4beb-b7d5-381a117d5184/deviceRunStates?$expand=managedDevice' | Get-MSGraphAllPages
$success = $result| Where-Object -Property errorCode -EQ 0
$resultMessage = $success.resultMessage 
$objResultMessage = $resultMessage | ConvertFrom-Json
$objResultMessage | Out-GridView 

 

 

 

MikeGriz_0-1619044884955.png


You can store the data in Log Analytics, SQL etc and visualize the way you want.
Enjoy!

8 Comments
Regular Visitor

Hi @MikeGriz , 

 

Thank you for wonderful article. I have followed the same but it is giving me below error. Can you suggest ?

 

umeshkumarchauhan_0-1619162555168.png

 

Microsoft

@umeshkumarchauhan Just a guess have you replaced the scriptID with the one in your environment? 

Invoke-MSGraphRequest -HttpMethod GET -Url 'deviceManagement/deviceManagementScripts/<yourScriptID>/deviceRunStates?$expand=managedDevice' | Get-MSGraphAllPages

 

Regular Visitor

YEs @MikeGriz , I have replaced the Script ID then only i have run this. Kindly suggest. Your article is very helpful. 

 

umeshkumarchauhan_0-1619267749057.pngumeshkumarchauhan_1-1619267772311.png

 

Senior Member

Great post, I have used the following script to collect W10 activation information from over 6000 devices. 

 

$COMPUTER=Get-CimInstance Win32_Computersystem
$BIOS=Get-CimInstance Win32_BIOS
$SLP=Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | where { $_.PartialProductKey }
$SLS=Get-CimInstance SoftwareLicensingService

$theThingIActuallyWant = New-Object psobject -Property @{
SystemName = $COMPUTER.Name
Manufacturer = $COMPUTER.manufacturer
Model=$COMPUTER.Model
SystemSKUNumber=$COMPUTER.SystemSKUNumber
Serialnumber=$BIOS.SerialNumber
ProductKeyChannel=$SLP.ProductKeyChannel
LicenseFamily=$SLP.LicenseFamily
PartialProductKey=$SLP.PartialProductKey
LicenseStatus=$SLP.LicenseStatus
OA3xOriginalProductKey=$SLS.OA3xOriginalProductKey
}

$theThingIActuallyWant | ConvertTo-Json -Compress

 

When I query the Graph Explorer I get the correct output, but I cannot convert back to json using the command convertfrom-json. 

 

I receive the following error message: 

At line:1 char:38
+ $objResultMessage = $resultMessage | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

Microsoft

@tjmklaver I wonder if some device reported non JSON output. Did you take a look at $resultMessage alone without convertFrom-Json?

Microsoft

@umeshkumarchauhan Do you see any results in the MEM portal for "Device Status"?

kubidag_0-1622762306737.png

 

Senior Member

@kubidag Yes, I did look at $resultMessage without convertfrom-json, but there are a lot of resultmessages (over 4000). I

instead used convertfrom-csv. With some help of find/replace in Excel I was able to read the report in the end. In this process I noticed that some resultmessages were in a different format, then expected. I believe this was causing the error message to do the output to json. Converting to CSV i was able to quickly get the necessary report.
2021-06-04_08-57-21.jpg

New Contributor

$resultMessage is returning a blank value in my case.

 

grvranjan_0-1631705967969.png

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2282770%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2282770%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F927267%22%20target%3D%22_blank%22%3E%40umeshkumarchauhan%3C%2FA%3E%26nbsp%3BJust%20a%20guess%20have%20you%20replaced%20the%20scriptID%20with%20the%20one%20in%20your%20environment%3F%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EInvoke-MSGraphRequest%20-HttpMethod%20GET%20-Url%20'deviceManagement%2FdeviceManagementScripts%2F%3CYOURSCRIPTID%3E%2FdeviceRunStates%3F%24expand%3DmanagedDevice'%20%7C%20Get-MSGraphAllPages%3C%2FYOURSCRIPTID%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2282256%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2282256%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F293153%22%20target%3D%22_blank%22%3E%40MikeGriz%3C%2FA%3E%26nbsp%3B%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20wonderful%20article.%20I%20have%20followed%20the%20same%20but%20it%20is%20giving%20me%20below%20error.%20Can%20you%20suggest%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22umeshkumarchauhan_0-1619162555168.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274917iD7FA131C3373EFF1%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22umeshkumarchauhan_0-1619162555168.png%22%20alt%3D%22umeshkumarchauhan_0-1619162555168.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2285679%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2285679%22%20slang%3D%22en-US%22%3E%3CP%3EYEs%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F293153%22%20target%3D%22_blank%22%3E%40MikeGriz%3C%2FA%3E%26nbsp%3B%2C%20I%20have%20replaced%20the%20Script%20ID%20then%20only%20i%20have%20run%20this.%20Kindly%20suggest.%20Your%20article%20is%20very%20helpful.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22umeshkumarchauhan_0-1619267749057.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F275258iD00771BE25C78513%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22umeshkumarchauhan_0-1619267749057.png%22%20alt%3D%22umeshkumarchauhan_0-1619267749057.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22umeshkumarchauhan_1-1619267772311.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F275259i9B7D2D14BAC53C96%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22umeshkumarchauhan_1-1619267772311.png%22%20alt%3D%22umeshkumarchauhan_1-1619267772311.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2280850%22%20slang%3D%22en-US%22%3EHow%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2280850%22%20slang%3D%22en-US%22%3E%3CP%3EKubilay%20Dagdelen%20on%20my%20team%20worked%20with%20several%20other%20folks%20to%20pull%20together%20a%20method%20for%20doing%20some%20custom%20inventory%20collection%20with%20Intune.%26nbsp%3B%20There%20are%20some%20performance%20delays%20that%20can%20be%20encountered%20if%20over-used%2C%20but%20it%20can%20be%20handy%20at%20times.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EConfigMgr%20admins%20love%20extending%20hardware%20inventory%20and%20collecting%20data%20from%20Windows%20devices.%3CBR%20%2F%3EDid%20you%20know%20Intune%20can%20do%20the%20same%3F!%3CBR%20%2F%3EThe%20answer%20is%20Intune%20PowerShell%20scripts!%20Also%20known%20as%20SideCar%E2%80%A6%20IME%E2%80%A6%20Intune%20Management%20Extensions%E2%80%A6%3C%2FP%3E%0A%3CP%3EWell%2C%20IME%20is%20just%20another%20channel%20that%20runs%20parallel%20to%20MDM%20that%20sort%20of%20acts%20like%20the%20ConfigMgr%20client.%20We%20deliver%20different%20features%20over%20this%20channel%3A%20PowerShell%20scripts%2C%20Win32%20apps%2C%20Proactive%20Remediation%20scripts%2C%20Win32%20app%20log%20collection%E2%80%A6%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3ECan%20you%20give%20us%20an%20example%3F%3C%2FSTRONG%3E%3CBR%20%2F%3EMaybe%20you%20are%20interested%20to%20know%20more%20about%20Win32_BIOS.%20%3CBR%20%2F%3ERun%20the%20following%20PowerShell%20one-liner%20on%20a%20device%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EGet-WmiObject%20-Class%20Win32_BIOS%20%7C%0Aselect%20CurrentLanguage%2C%0ADescription%2C%0AEmbeddedControllerMajorVersion%2C%0AEmbeddedControllerMinorVersion%2C%0AManufacturer%2C%0AReleaseDate%2C%0ASerialNumber%20%7C%20ConvertTo-Json%20-Compress%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EScript%20outputs%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MikeGriz_0-1619043818972.png%22%20style%3D%22width%3A%201177px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274475iDF121E2E728666BC%2Fimage-dimensions%2F1177x100%3Fv%3Dv2%22%20width%3D%221177%22%20height%3D%22100%22%20role%3D%22button%22%20title%3D%22MikeGriz_0-1619043818972.png%22%20alt%3D%22MikeGriz_0-1619043818972.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBeautified%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-yaml%22%3E%3CCODE%3E%7B%0A%22CurrentLanguage%22%3A%20%22en-US%22%2C%0A%22Description%22%3A%20%22N2EET43W%20(1.25%20)%22%2C%0A%22EmbeddedControllerMajorVersion%22%3A%201%2C%0A%22EmbeddedControllerMinorVersion%22%3A%2013%2C%0A%22Manufacturer%22%3A%20%22LENOVO%22%2C%0A%22ReleaseDate%22%3A%20%2220191028000000.000000%2B000%22%2C%0A%22SerialNumber%22%3A%20%2212345678%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ELet%E2%80%99s%20create%20an%20Intune%20PowerShell%20script%20and%20deploy%20it%20to%20some%20users%2Fdevices%20to%20demonstrate%20Win32_BIOS%20data%20as%20an%20example.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MikeGriz_2-1619043913367.png%22%20style%3D%22width%3A%20537px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274477iD1DA958A52289415%2Fimage-dimensions%2F537x317%3Fv%3Dv2%22%20width%3D%22537%22%20height%3D%22317%22%20role%3D%22button%22%20title%3D%22MikeGriz_2-1619043913367.png%22%20alt%3D%22MikeGriz_2-1619043913367.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ETip%3A%20%3CSCRIPTID%3E%20is%20stored%20in%20the%20URL%3C%2FSCRIPTID%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MikeGriz_3-1619043946125.png%22%20style%3D%22width%3A%20931px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274478iBB7C67A550EBF0D3%2Fimage-dimensions%2F931x49%3Fv%3Dv2%22%20width%3D%22931%22%20height%3D%2249%22%20role%3D%22button%22%20title%3D%22MikeGriz_3-1619043946125.png%22%20alt%3D%22MikeGriz_3-1619043946125.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EYou%20can%20access%20the%20data%20via%20the%20following%20Graph%20endpoint%20in%20graph%20explorer%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2FdeviceManagement%2FdeviceManagementScripts%2F%26lt%3BscriptID%26gt%3B%2FdeviceRunStates%3F%24expand%3DmanagedDevice%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2FdeviceManagement%2FdeviceManagementScripts%2F%3CSCRIPTID%3E%2FdeviceRunStates%3F%24expand%3DmanagedDevice%3C%2FSCRIPTID%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20turns%20out%20that%20we%20store%20the%20above-mentioned%20script%20output%20in%20a%20property%20on%20the%20service%20side.%20If%20you%20are%20familiar%20with%20Graph%20Explorer%2C%20then%20you%20can%20take%20a%20look%20at%20the%20results%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIn%20the%20property%20%E2%80%9CresultMessage%E2%80%9D%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MikeGriz_4-1619043988087.png%22%20style%3D%22width%3A%20889px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274479iB027FB12D942EC6C%2Fimage-dimensions%2F889x127%3Fv%3Dv2%22%20width%3D%22889%22%20height%3D%22127%22%20role%3D%22button%22%20title%3D%22MikeGriz_4-1619043988087.png%22%20alt%3D%22MikeGriz_4-1619043988087.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3EHow%20do%20I%20see%20the%20data%20from%20all%20devices%3F%3C%2FSTRONG%3E%3CBR%20%2F%3EPrerequisites%3A%3CBR%20%2F%3EInstall-Module%20-Name%20Microsoft.Graph.Intune%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EYou%20need%20one%20more%20script%20to%20retrieve%20your%20results%20from%20Graph%E2%80%A6%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EUpdate-MSGraphEnvironment%20-SchemaVersion%20'beta'%0AConnect-MSGraph%0A%0A%24result%20%3D%20Invoke-MSGraphRequest%20-HttpMethod%20GET%20-Url%20'deviceManagement%2FdeviceManagementScripts%2Fb113448a-528a-4beb-b7d5-381a117d5184%2FdeviceRunStates%3F%24expand%3DmanagedDevice'%20%7C%20Get-MSGraphAllPages%0A%24success%20%3D%20%24result%7C%20Where-Object%20-Property%20errorCode%20-EQ%200%0A%24resultMessage%20%3D%20%24success.resultMessage%20%0A%24objResultMessage%20%3D%20%24resultMessage%20%7C%20ConvertFrom-Json%0A%24objResultMessage%20%7C%20Out-GridView%20%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MikeGriz_0-1619044884955.png%22%20style%3D%22width%3A%20800px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274482i161F73280266207D%2Fimage-dimensions%2F800x350%3Fv%3Dv2%22%20width%3D%22800%22%20height%3D%22350%22%20role%3D%22button%22%20title%3D%22MikeGriz_0-1619044884955.png%22%20alt%3D%22MikeGriz_0-1619044884955.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EYou%20can%20store%20the%20data%20in%20Log%20Analytics%2C%20SQL%20etc%20and%20visualize%20the%20way%20you%20want.%3CBR%20%2F%3EEnjoy!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2280850%22%20slang%3D%22en-US%22%3E%3CP%3EIntune%20inventory%20may%20not%20yet%20be%20as%20rich%20as%20Configuration%20Manger%2C%20but%20we%20have%20found%20one%20method%20to%20get%20a%20little%20more%20out%20of%20Intune%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2412867%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2412867%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20post%2C%20I%20have%20used%20the%20following%20script%20to%20collect%20W10%20activation%20information%20from%20over%206000%20devices.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24COMPUTER%3DGet-CimInstance%20Win32_Computersystem%3CBR%20%2F%3E%24BIOS%3DGet-CimInstance%20Win32_BIOS%3CBR%20%2F%3E%24SLP%3DGet-CimInstance%20SoftwareLicensingProduct%20-Filter%20%22Name%20like%20'Windows%25'%22%20%7C%20where%20%7B%20%24_.PartialProductKey%20%7D%3CBR%20%2F%3E%24SLS%3DGet-CimInstance%20SoftwareLicensingService%3C%2FP%3E%3CP%3E%24theThingIActuallyWant%20%3D%20New-Object%20psobject%20-Property%20%40%7B%3CBR%20%2F%3ESystemName%20%3D%20%24COMPUTER.Name%3CBR%20%2F%3EManufacturer%20%3D%20%24COMPUTER.manufacturer%3CBR%20%2F%3EModel%3D%24COMPUTER.Model%3CBR%20%2F%3ESystemSKUNumber%3D%24COMPUTER.SystemSKUNumber%3CBR%20%2F%3ESerialnumber%3D%24BIOS.SerialNumber%3CBR%20%2F%3EProductKeyChannel%3D%24SLP.ProductKeyChannel%3CBR%20%2F%3ELicenseFamily%3D%24SLP.LicenseFamily%3CBR%20%2F%3EPartialProductKey%3D%24SLP.PartialProductKey%3CBR%20%2F%3ELicenseStatus%3D%24SLP.LicenseStatus%3CBR%20%2F%3EOA3xOriginalProductKey%3D%24SLS.OA3xOriginalProductKey%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%24theThingIActuallyWant%20%7C%20ConvertTo-Json%20-Compress%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20query%20the%20Graph%20Explorer%20I%20get%20the%20correct%20output%2C%20but%20I%20cannot%20convert%20back%20to%20json%20using%20the%20command%20convertfrom-json.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20receive%20the%20following%20error%20message%3A%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20line%3A1%20char%3A38%3CBR%20%2F%3E%2B%20%24objResultMessage%20%3D%20%24resultMessage%20%7C%20ConvertFrom-Json%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20NotSpecified%3A%20(%3A)%20%5BConvertFrom-Json%5D%2C%20ArgumentException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20System.ArgumentException%2CMicrosoft.PowerShell.Commands.ConvertFromJsonCommand%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414722%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414722%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F250154%22%20target%3D%22_blank%22%3E%40tjmklaver%3C%2FA%3E%26nbsp%3BI%20wonder%20if%20some%20device%20reported%20non%20JSON%20output.%20Did%20you%20take%20a%20look%20at%20%24resultMessage%20alone%20without%20convertFrom-Json%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414724%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20collect%20custom%20inventory%20from%20Azure%20AD%20Joined%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414724%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F927267%22%20target%3D%22_blank%22%3E%40umeshkumarchauhan%3C%2FA%3E%26nbsp%3BDo%20you%20see%20any%20results%20in%20the%20MEM%20portal%20for%20%22Device%20Status%22%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22kubidag_0-1622762306737.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F286197iBE7F4FF038142586%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22kubidag_0-1622762306737.png%22%20alt%3D%22kubidag_0-1622762306737.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Jun 03 2021 08:14 AM
Updated by: