How to a list room's accounts that has 'LimitedDetails' accesrights in Default user?

MARTI MUÑOZ, VICTOR 21 Reputation points
2022-11-11T18:37:52.627+00:00

I have several room's accounts that has correct configuration set as 'LimitedDetails' in AccessRight attibute for 'Default' user, but in other hand there is a several accounts that the configuration is not correct (is set as 'AvailabilityOnly').

I need a list of accounts that has 'AvailabilityOnly' set in Default user and I did this, it works but the result shows different as I expected: "Microsoft.Exchange.Management.StoreTasks.MailboxFolderPermission" instead of "LimitedDetails" or "AvailabilityOnly".

This is my script:

$rooms=Get-Mailbox -ResultSize unlimited | where-object {$_.Recipienttypedetails -like "RoomMailbox"}  
$report_file="\\my_machine\rooms_$(Get-Date -Format yyyy_MM_dd-hh_mm_ss).csv"  
  
Add-Content $report_file "SAN;Name;DisplayName;Mail;Permission" -Encoding UTF8  
  
foreach($room in $rooms){  
    $calendar=Get-CalendarProcessing -Identity $room.Identity | select sAMAccountName,displayName,PrimarySmtpAddress  
    $id_AD=Get-ADUser  -Filter "mail -eq '$($room.UserPrincipalName)'" -Properties *  
    $room2=$room.Identity  
    $room2=$room2+"@myemail.com:\Calendar"  
    $Mailbox=Get-MailboxFolderPermission -Identity $room2 -User Default  
          
    Add-Content $report_file "$($id_AD.SamAccountName);$($room.name);$($room.displayName);$($room.PrimarySmtpAddress);$($Mailbox)" -Encoding UTF8      
}  

In fact, I need list of this from list of rooms in txt or csv file:

259589-image.png

What I get with this script:

259570-image.png

What I need:

259579-image.png

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,449 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 33,951 Reputation points Microsoft Vendor
    2022-11-14T03:47:20.883+00:00

    Hi,

    Please try replacing $($Mailbox) with $($Mailbox.AccessRights) in Line 13.

    Best Regards,
    Ian Xue

    -----------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. MARTI MUÑOZ, VICTOR 21 Reputation points
    2022-11-14T10:07:27.227+00:00

    Hi @Ian Xue (Shanghai Wicresoft Co., Ltd.)

    It worked, many thanks for helping.

    Regards.

    0 comments No comments