Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Dynamic Device Group for Intune based on EnrollmentDate
Post Body

Dear,

I created a script, which give me out all Intune Registered devices based on a specific time frame (for e.g. registered in the last two days):

Install-Module -Name Microsoft.Graph.Intune
Import-Module Microsoft.Graph.Intune
Connect-MSGraph

$targetaadgroupname = "RegisteredDevices"


$limit = (Get-Date).AddDays(-2) 
Get-IntuneManagedDevice -filter "operatingSystem eq 'Windows'" |Where-Object { $_.enrolledDateTime -gt $limit }  | Select deviceName, enrolledDateTime, operatingSystem |ft

Now I want, that the devices I get from this output will be added as a member to the Group "RegisteredDevices".

I tried to do it with the Add-AzureADGroupMember cmdlet, but unfortunately it's not working (no member are added). Also tried to work with a pipe, but result is the same.

Can you may assist in this case on how to add the output (devices) into the group?

Thanks in advance!

Author
Account Strength
60%
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
68
Link Karma
31
Comment Karma
37
Profile updated: 13 hours ago
Posts updated: 1 day ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago