User Profile
fstorer
Brass Contributor
Joined 6 years ago
User Widgets
Recent Discussions
Get a list of specific agegroup users stored on a security group
Dear Community, I wonder if it would be possible to get a list of users (stored in a security group) marked as "minor" and "not adult" using microsoft graph. Once I get the members of the group (using Get-MgGroupMember -GroupId XXXX), I am not sure how to retrieve only the ones with a specific agegroup property. Is that feasible? Any help would be greatly appreciated. Many thanks in advance!SolvedRe: Get a report showing specific shared mailboxes and Display Names of their members on one line.
I was able to get what I wanted, although the Display Names are not sorted alphabetically. Thank you VasilMichev This is the code: $jobs = Get-ExoMailbox -RecipientTypeDetails SharedMailbox -Filter {DisplayName -like "jobs-*"} | Sort-Object DisplayName $JobsReport = @() foreach ($job in $jobs) { $members = Get-MailboxPermission -Identity $job.Identity | Where-Object { ($_.User -like '*@*') $memberNames = @() foreach ($member in $members) { $memberName = (Get-Mailbox $member.User).DisplayName $memberNames += $memberName } $membersString = $memberNames -join ", " $JobsReport += [PSCustomObject]@{ "Jobs Accounts" = $job.DisplayName "Members with Full Access" = $membersString } } $JobsReport = $JobsReport | Sort-Object "Jobs Accounts"661Views0likes2CommentsRe: Get a report showing specific shared mailboxes and Display Names of their members on one line.
Thank you VasilMichev for your reply. I tried the code, but it doesn't work. For each shared mailbox I get only one name and not the full list of members. Is there something else I am missing?691Views0likes5CommentsGet a report showing specific shared mailboxes and Display Names of their members on one line.
Dear Community, I have been asked to generate an excel report showing all our shared mailboxes starting with "jobs-". For each shared mailbox we want to see the members' Display Names (not the email addresses) sorted in alphabetical order, and these should stay on one line (not in a column). I was able to get the shared mailboxes and the Display Names, but not the "one line" request. Is there anyone who can help me with the code? Many thanks in advance! $jobs = Get-EXOMailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited -Filter { DisplayName -like 'jobs-*' } $JobsReport = @() foreach ($job in $jobs) { $Members = Get-MailboxPermission $job.identity | Where-Object { ($_.User -like '*@*') | Sort-Object User foreach ($Member in $Members) { $DisplayName = ((Get-User $Member.User).DisplayName) -join ', ' $JobsReport += [PSCustomObject]@{ SharedMailbox = $job.Alias MemberDN = $DisplayName } } }Solved751Views0likes7CommentsRe: Is there a way to reset/wipe all data from M365 user accounts in order to re-use the same accounts?
eliekarkafy thanks, I found the page with the information I needed. I see that Files saved in OneDrive for Business aren't deleted unless the user is deleted from the Microsoft 365 admin center or is removed through Active Directory synchronization. For more information, see OneDrive retention and deletion. So I guess the only solution is still deleting the accounts and then recreating them.5.3KViews0likes1CommentRe: Is there a way to reset/wipe all data from M365 user accounts in order to re-use the same accounts?
eliekarkafy if I remove the licenses from those accounts and then re-assign them later, will all the previous data in those accounts be accessible again? Or everything is wiped when you remove a Microsoft license?5.3KViews0likes3CommentsRe: Is there a way to reset/wipe all data from M365 user accounts in order to re-use the same accounts?
eliekarkafy that's exactly my question. We can delete all the accounts and set them up again for the next academic year, but we were wondering if we can keep them with all their settings and wipe/remove ONLY the OneDrive/Outlook data. Again, probably deleting and recreating them is the quickest solution...5.3KViews0likes5CommentsRe: Is there a way to reset/wipe all data from M365 user accounts in order to re-use the same accounts?
eliekarkafy thank you for your quick reply. Unfortunately that solution is not feasible at the moment for us because we don't have an Azure AD Premium P2 or E5 license. Francesco5.4KViews0likes7CommentsIs there a way to reset/wipe all data from M365 user accounts in order to re-use the same accounts?
Dear all, I apologize in advance if I am posting my question in the wrong place. Every year we have external people coming to our campus who need to access specific school resources just for a few months. We have created several accounts for them with policy restrictions and we are happy with this solution. We were wondering if there is a way to automate the deletion of all their data (mainly OneDrive files/Outlook emails) at the end of their stay here in order to keep those accounts clean for the upcoming persons. We don't want to do this task manually. Is it quicker to delete the accounts and re-create them every year? Many thanks in advance for any help FrancescoSolvedRe: Shared Calendars - is there a way to set them up in Outlook client without accepting an invite?
VasilMichev Thank you for your reply. Unfortunately not, I have already tried that. When you click on that option (Open Shared Calendar) you can search only in the GAL and if you select the shared mailbox, it will then add only the default calendar (all the other calendars are missing). If you try to type the names of the shared calendars, it simply returns "Microsoft Outlook doesn't recognize "XXX".1.2KViews0likes0CommentsShared Calendars - is there a way to set them up in Outlook client without accepting an invite?
Hello everyone, We have a shared mailbox with several calendars inside, and they should all be accessible from the staff. We have generated ICS links for each of them, but some needed a restricted view because the link is shared also with external people. When new staff members start working for our company, we shared all these calendars with them assigning "Reviewer permissions". The way we share these calendars is via outlook invites (they only need to click on the "Accept" button and the calendars pop up under the "Shared Calendars" area). Sometimes people lose their connection with the shared calendars, getting the following message: If I check the mailboxfolderpermissions I can see that these users are still there with the correct permissions, but they can't open the shared calendars anymore. I usually remove the user and send him/her another invite. Is there a way for the users to add these calendars themselves? They can't use all the generated ICS links because some of them have restricted views and if they try to add the shared mailbox in their outlook clients, only the default calendar shows up. Or is there a third party tool that can do this? Any help would be much appreciated! Francesco1.2KViews0likes2CommentsRe: How to quickly assign different permissions to shared calendars to different people
Diane_Poremsky_MVP Thanks for your reply. You are right, I can create another security group for secretaries or in general for the "editors" and then assign the permissions directly to the group instead of the single members. I am just worried that this can generate some conflicts because Secretaries/Editors will be both in the main Staff security group and in the new one. Will the script overwrite the previous permissions? Or should I use something like this: $SharedCalendars = @( "email address removed for privacy reasons:\Calendar\Test Dates", "email address removed for privacy reasons:\Calendar\Test1 Dates", "email address removed for privacy reasons:\Calendar\Test2 Dates", "email address removed for privacy reasons:\Calendar\Test3 Dates", "email address removed for privacy reasons:\Calendar\Test4 Dates", etc. ) $SharedCalendars.ForEach{ Add-MailboxFolderPermission -Identity $_ -User STAFF_SECURITYGROUP -AccessRights Reviewer -SendNotificationToUser $true Set-MailboxFolderPermission -Identity $_ -User EDITORS_SECURITYGROUP -AccessRights Editor -SendNotificationToUser $true } The problem is that the main Staff Security Group is a Security Group, not a mail-enabled Security group (according to the reference, I can use only email-enabled Security Group). Also, I am not sure how to manage the notifications (only the new starters should receive the Outlook sharing invitations). It can happen that during the year old staff members delete the shared calendars and they don't know how to add them again to their Outlook client, so they ask IT support to re-send the notifications (clicking on the "Accept" button is just easier for them). What would you suggest? So far I wrote a script where I get all the starters in a variable (thanks to LainRobertson who showed me the quickest way) and then assign them the "Reviewer" permissions: $Starters = Get-MgUser -Filter "CreatedDateTime ge $([datetime]::UtcNow.AddDays(-64).ToString("s"))Z" -ExpandProperty memberOf -All | Where-Object {($_.MemberOf.Id -contains 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')} | Sort-Object -Property UserPrincipalName | Select-Object UserPrincipalName $Starters.ForEach{ Add-MailboxFolderPermission -Identity "xxxxxx:\Calendar\Test Dates" -User $_ -AccessRights Reviewer -SendNotificationToUser $true Add-MailboxFolderPermission -Identity "xxxxxx:\Calendar\Test1 Dates" -User $_ -AccessRights Reviewer -SendNotificationToUser $true Add-MailboxFolderPermission -Identity "xxxxxx:\Calendar\Test2 Dates" -User $_ -AccessRights Reviewer -SendNotificationToUser $true Add-MailboxFolderPermission -Identity "xxxxxx:\Calendar\Test3 Dates" -User $_ -AccessRights Reviewer -SendNotificationToUser $true etc. }2.1KViews0likes0CommentsRe: Find all the AzureADUsers created after a certain date via PowerShell Graph
LainRobertson Thank you for your suggestion! However, when I try to filter on the groups I don't get anything. The new members have multiple groups assigned, but they are all members of a specific security group. I am not sure how to search for the specific GUID inside the "MemberOf" property: Get-MgUser -Filter "CreatedDateTime ge $([datetime]::UtcNow.AddDays(-62).ToString("s"))Z" -ExpandProperty memberOf | Where-Object {($_.MemberOf -in 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')} | Select-Object Id, DisplayName, UserPrincipalName, JobTitle, CreatedDateTime What am I doing wrong? Am I using the wrong operator? Or is it because of the "ExpandProperty"? Many thanks in advance!13KViews0likes1CommentRe: Find all the AzureADUsers created after a certain date via PowerShell Graph
LainRobertson Many many thanks for your tip, it's indeed a lot faster! I also noticed that I have to select the "beta" MGProfile in order to see the CreatedDateTime. This way I got immediately all the users created after a specific date (staff and students and shared mailboxes), is there a way to add a filter in that line and search ONLY members assigned to a specific Security Group (so I can get only the staff users)? Many thanks again for your help!13KViews0likes3CommentsHow to quickly assign different permissions to shared calendars to different people
Hello everyone, In our organization we have a shared mailbox with multiple calendars within (around 10 calendars). These calendars need to be shared with all staff members, who should have "Reviewer" permissions. There are a few people (the secretaries), though, who need to have "Editor" permissions, because they are responsible of editing all these calendars. Also, every year our Staff security group is populated with new staff members who need to access those calendars possibly via email notifications. Would it be possible to create a script which: - Check all the members within the Staff Security group; - Identify the (new) members who don't have any access/permissions to the shared calendars; - Assign "Reviewer" permissions to each of them; then - Check all the members in a variable named $Secretaries (it would be great to populate this variable finding the word "Secretary" in the job title of each staff member); - Assign "Editor" permissions to all the secretaries. In the past new members were added manually one by one via the GUI. I created a variable with all the calendars inside: $SharedCalendars = @( "email address removed for privacy reasons:\Calendar\Test Dates", "email address removed for privacy reasons:\Calendar\Test1 Dates", "email address removed for privacy reasons:\Calendar\Test2 Dates", "email address removed for privacy reasons:\Calendar\Test3 Dates", "email address removed for privacy reasons:\Calendar\Test4 Dates", etc. ) Then I know that I can run for each calendar the Add-MailboxFolderPermission and also send the notifications $SharedCalendars.ForEach{ Add-MailboxFolderPermission -Identity $_ -User email address removed for privacy reasons -AccessRights Reviewer -SendNotificationToUser $true } If I want to populate the $Secretaries variable, I can use something like this: $Users = Get-MgGroupMember -GroupId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -All $UsersJob = $Users.ForEach{ Get-MgUser -UserId $_.Id -Property Id, DisplayName, UserPrincipalName, Mail, JobTitle } $Secretaries = $UsersJob | Where-Object {($_.JobTitle -like '*Secretary*')} | Select-Object -Property Id, DisplayName, UserPrincipalName, Mail, JobTitle | Sort-Object -Property UserPrincipalName but I am missing all the part of assigning the "Reviewer" permissions for each new member and the "Editor" permissions for the secretaries. Any help would be much appreciated. Many thanks in advance! FrancescoFind all the AzureADUsers created after a certain date via PowerShell Graph
Hello everyone, As Microsoft will eventually retire the AzureAD and MSOL PowerShell modules (March 2023?), I am trying to update all the PowerShell scripts based on those modules with new ones based on Microsoft Graph API calls and PowerShell Graph SDK. I am struggling with a script which should find all the AzureAD members created after 1 July 2022 inside a specific Security Group. The script should generate a list of these "new starters" and retrieve the following information: DisplayName, UPN, ID, Email, JobTitle. This is what I got so far: [datetime]$Date = (Get-Date).adddays(-60) $Users = Get-MgGroupMember -GroupId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -All $Users.Count $UsersCreatedDate = $Users.ForEach{ Get-MgUser -UserId $_.Id | Select-Object -Property Id, UserPrincipalName, JobTitle, CreatedDateTime } Getting all the users takes some time (we have around 400 members in that Security group), I am not sure if there is a quicker way to get those information. Then I tried to filter that list using the "where-object" $UsersCreatedDate | Where-Object {($_.CreatedDateTime -gt '$Date')} but to no avail. I am always getting the error Could not compare "06/20/2017 09:00:00" to "$DateTime". Error: "Cannot convert value "$DateTime" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."" What am I doing wrong? Any help would be much appreciated! Many thanks in advance FrancescoSolvedRe: Stream Audit Log - Script to check who viewed/liked a video returns the same element multiple times
Thank you LainRobertson for your quick reply! I can confirm that the duplicates (around 40/50 for every element) are both in the output from the native Search-UnifiedAuditLog and the output from (Search-UnifiedAuditLog).AuditData | ConvertFrom-Json. The "-unique" parameter does the job but I can't explain why I am getting all those duplicates in the source data. The script below (based on this article and script from Tony Redmond) also returns unique objects, although I didn't run the "measure-command" to see how much it takes to execute: $StartDate = (Get-Date).AddDays(-30) $EndDate = (Get-Date) $OutputCSVFile = "C:\Temp\VideoViewers.csv" $VideoTitle = "<TITLE>" [array]$Records = (Search-UnifiedAuditLog -RecordType MicrosoftStream -Operations StreamInvokeVideoView -StartDate $StartDate -EndDate $EndDate -Formatted -ResultSize 1000) $VideoViewers = [System.Collections.Generic.List[Object]]::new() ForEach ($Rec in $Records) { $AuditData = $Rec.AuditData | ConvertFrom-Json If ($AuditData.ResourceTitle -eq $VideoTitle) { $Data = [PSCustomObject]@{ User = $Rec.UserIds IP = $AuditData.ClientIP ViewDate = $Rec.CreationDate Title = $AuditData.ResourceTitle FullURL = $AuditData.ObjectId } $VideoViewers.Add($Data) } # End if } # End ForEach $VideoViewers | Sort-Object User | Export-Csv -NoTypeInformation $OutputCSVFile Thanks again for all the help, it is much appreciated! Francesco1.2KViews1like0Comments
Groups
Recent Blog Articles
No content to show