troubleshooting Question

Powershell Azure Active Directory - Need Numbers from Names of Devices

Avatar of Chris Bush
Chris BushFlag for United States of America asked on
PowershellActive DirectoryAzure
4 Comments1 Solution165 ViewsLast Modified:
Ok gang,

I have a CSV of Device Names in Azure AD, I want to get a list of DeviceID or ObjectId for each of the names on the list.

I have tried the following
#
$CHGList = Import-Csv -path C:\Users\username\desktop\CHGList.csv

get-msoldevice -name $CHGList | Select-Object ObjectID | Export-CSV -Path "C:\Users\username\desktop\AzureDeviceID.csv"
#

I have tried piping over results and running it that way
I have tried changing the Custom Object  to a String
I have tried

#
$CHGList = Import-Csv -path C:\Users\username\desktop\CHGList.csv
$Modification = $null
$Modification = $CHGList -join ","
get-msoldevice -name $Modification | Select-Object ObjectID | Export-CSV -Path "C:\Users\username\desktop\AzureDeviceID.csv"
#

I've looked at trying to loop through the CSV file and it's making no sense.

Can I get some help?

Thanks all for your time.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros