Forum Discussion
Security recommendations software update
- davidsharvit40Feb 06, 2024Copper Contributor
Hi Tim!
Someone got back to me on another forum with a great option that solved my problem-
Install-Module -Name AzureAD -AllowClobber -Scope CurrentUser
Import-Module AzureAD
Connect-AzureAD*Change device1 etc... names to the real devices
# Specify the device names
$deviceNames = @("Device1", "Device2", "Device3", "Device4")foreach ($deviceName in $deviceNames) {
# Get device information
$device = Get-AzureADDevice -Filter "displayName eq '$deviceName'"# Check if the device was found
if ($device) {
# Retrieve Member Object ID and UPN
$memberObjectId = $device.ObjectId
$userPrincipalName = $device.UserPrincipalName# Display the results
Write-Host "Device: $deviceName"
Write-Host "Member Object ID: $memberObjectId"
Write-Host "User Principal Name (UPN): $userPrincipalName"
Write-Host "---------------------------"
} else {
Write-Host "Device '$deviceName' not found."
}
}- TimBoschFeb 08, 2024Brass ContributorGreat option!
That was i was looking after but I wanted to check if it's possible to get the devices affected by the recommendation and then get it into a CSV file.
Great that you found the solution.