Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
microsoft_exchange [2026/01/14 14:05] jango [Mail enabled] |
microsoft_exchange [2026/01/15 12:17] (aktuell) jango [Public Folder] |
||
|---|---|---|---|
| Zeile 384: | Zeile 384: | ||
| # alle public folder | # alle public folder | ||
| Get-PublicFolder -Recurse -ResultSize Unlimited | Get-PublicFolder -Recurse -ResultSize Unlimited | ||
| + | |||
| + | # Nur Top-Level | ||
| + | Get-PublicFolder -ResultSize Unlimited -Recurse | select Name, | ||
| + | |||
| + | Add-PublicFolderClientPermission -Identity \My-Folder -User test.user -AccessRights Editor|Owner|Publisher | ||
| + | Get-PublicFolderClientPermission -Identity \My-Folder | ||
| + | Remove-PublicFolderClientPermission -Identity \My-Folder -User test.user | ||
| </ | </ | ||
| Zeile 421: | Zeile 428: | ||
| </ | </ | ||
| + | bzw. | ||
| + | |||
| + | < | ||
| + | RunspaceId | ||
| + | Identity | ||
| + | Name : DUMMY-Newsletter | ||
| + | MailEnabled | ||
| + | MailRecipientGuid | ||
| + | ParentPath | ||
| + | LostAndFoundFolderOriginalPath : | ||
| + | ContentMailboxName | ||
| + | ContentMailboxGuid | ||
| + | EformsLocaleId | ||
| + | PerUserReadStateEnabled | ||
| + | EntryId | ||
| + | DumpsterEntryId | ||
| + | ParentFolder | ||
| + | OrganizationId | ||
| + | AgeLimit | ||
| + | RetainDeletedItemsFor | ||
| + | ProhibitPostQuota | ||
| + | IssueWarningQuota | ||
| + | MaxItemSize | ||
| + | LastMovedTime | ||
| + | AdminFolderFlags | ||
| + | FolderSize | ||
| + | HasSubfolders | ||
| + | FolderClass | ||
| + | FolderPath | ||
| + | AssociatedDumpsterFolders | ||
| + | DefaultFolderType | ||
| + | ExtendedFolderFlags | ||
| + | MailboxOwnerId | ||
| + | IsValid | ||
| + | ObjectState | ||
| + | </ | ||
| + | |||
| + | ===Test Script=== | ||
| + | |||
| + | <code powershell> | ||
| + | # EWS Config | ||
| + | $MailboxForAutodiscover = " | ||
| + | $UseDefaultCredentials | ||
| + | $EwsCred = Get-Credential | ||
| + | |||
| + | function Get-PublicFolderFolderClassEws { | ||
| + | param([Parameter(Mandatory)][string]$PfPath) | ||
| + | |||
| + | # DLL laden (Standardpfad; | ||
| + | $dll = " | ||
| + | if (-not (" | ||
| + | if (-not (Test-Path $dll)) { return $null } | ||
| + | Add-Type -Path $dll | ||
| + | } | ||
| + | |||
| + | $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService( | ||
| + | [Microsoft.Exchange.WebServices.Data.ExchangeVersion]:: | ||
| + | ) | ||
| + | |||
| + | if ($UseDefaultCredentials) { | ||
| + | $service.UseDefaultCredentials = $true | ||
| + | } else { | ||
| + | $service.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials( | ||
| + | $EwsCred.UserName, | ||
| + | ) | ||
| + | } | ||
| + | |||
| + | $service.AutodiscoverUrl($MailboxForAutodiscover, | ||
| + | |||
| + | $current = [Microsoft.Exchange.WebServices.Data.Folder]:: | ||
| + | $service, [Microsoft.Exchange.WebServices.Data.WellKnownFolderName]:: | ||
| + | ) | ||
| + | |||
| + | foreach ($seg in $PfPath.Trim(" | ||
| + | $view = New-Object Microsoft.Exchange.WebServices.Data.FolderView(100) | ||
| + | $filter = New-Object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo( | ||
| + | [Microsoft.Exchange.WebServices.Data.FolderSchema]:: | ||
| + | ) | ||
| + | $res = $service.FindFolders($current.Id, | ||
| + | if ($res.TotalCount -lt 1) { return $null } | ||
| + | $current = $res.Folders[0] | ||
| + | } | ||
| + | |||
| + | return $current.FolderClass | ||
| + | } | ||
| + | |||
| + | function Show-Subs { | ||
| + | param( | ||
| + | [Parameter(Mandatory)] $ParentEntryId, | ||
| + | [int] $Level = 1 | ||
| + | ) | ||
| + | |||
| + | $subs = Get-PublicFolder -ResultSize Unlimited -Recurse | Where-Object { $_.ParentFolder -eq $ParentEntryId } | ||
| + | |||
| + | foreach ($sub in $subs) { | ||
| + | |||
| + | $perms = Get-PublicFolderClientPermission -Identity $sub.Identity -ErrorAction SilentlyContinue | ||
| + | $owners = $perms | Where-Object { $_.AccessRights -contains " | ||
| + | if (-not $owners) { $owners = "< | ||
| + | $permString = ($perms | ForEach-Object { " | ||
| + | |||
| + | #Write-Host (" | ||
| + | Write-Host (" | ||
| + | Write-Host ("{0}- EntryId: {1}" -f (" | ||
| + | Write-Host ("{0}- ParentFolder: | ||
| + | |||
| + | Write-Host ("{0}- Owner(s): {1}" -f (" | ||
| + | Write-Host ("{0}- Permissions: | ||
| + | |||
| + | $addr = Get-MailPublicFolder -Identity $sub.Identity -ErrorAction SilentlyContinue | ||
| + | if ($addr -and $addr.PrimarySmtpAddress) { | ||
| + | Write-Host ("{0}- Address: {1}" -f (" | ||
| + | } else { | ||
| + | Write-Host ("{0}- Address: ---" -f (" | ||
| + | } | ||
| + | |||
| + | $type = Get-PublicFolderFolderClassEws -PfPath $sub.Identity | ||
| + | if (-not $type) { $type = "< | ||
| + | Write-Host ("{0}- Type: {1}" -f (" | ||
| + | |||
| + | Show-Subs -ParentEntryId $sub.EntryId -Level ($Level + 1) | ||
| + | |||
| + | } | ||
| + | } | ||
| + | |||
| + | Get-PublicFolder -ResultSize Unlimited -Recurse | Where-Object { $_.ParentPath -eq " | ||
| + | | ||
| + | $curr = $_ | ||
| + | | ||
| + | $perms = Get-PublicFolderClientPermission -Identity $curr.Identity -ErrorAction SilentlyContinue | ||
| + | $owners = $perms | Where-Object { $_.AccessRights -contains " | ||
| + | if (-not $owners) { $owners = "< | ||
| + | $permString = ($perms | ForEach-Object { " | ||
| + | |||
| + | #Write-Host " | ||
| + | Write-Host " | ||
| + | Write-Host "`t- EntryId: $($curr.EntryId)" | ||
| + | Write-Host "`t- ParentFolder: | ||
| + | Write-Host ("`t- Owner(s): {0}" -f ($owners -join ', ')) | ||
| + | Write-Host ("`t- Permissions: | ||
| + | |||
| + | try { | ||
| + | $addr = Get-MailPublicFolder -Identity $curr.Identity -ErrorAction SilentlyContinue | ||
| + | if ($addr -and $addr.PrimarySmtpAddress) { | ||
| + | Write-Host ("`t- Address: {0}" -f ($addr.PrimarySmtpAddress)) | ||
| + | } else { | ||
| + | Write-Host ("`t- Address: ---") | ||
| + | } | ||
| + | } catch {} | ||
| + | |||
| + | $type = Get-PublicFolderFolderClassEws -PfPath $curr.Identity | ||
| + | if (-not $type) { $type = "< | ||
| + | Write-Host ("`t- Type: {0}" -f $type) | ||
| + | |||
| + | Show-Subs -ParentEntryId $curr.EntryId -Level 1 | ||
| + | |||
| + | } | ||
| + | </ | ||
| ====Mail enabled==== | ====Mail enabled==== | ||