powershellscriptingruntime-errorpublic-folders

Cannot convert the "System.Collections.ArrayList" value of type "System.Collections.ArrayList"


Cannot process argument transformation on parameter 'Identity'. Cannot convert the "System.Collections.ArrayList" value of type "System.Collections.ArrayList" to type "Microsoft.Exchange.Configuration.Tasks.PublicFolderIdParameter". is the entire error...

Basically, we want to migrate our pub folders to shared boxes and I am attempting to get public folder permissions on the existing structure...

The issue is with the last line here... I am not sure why it is throwing this. I originally wanted to bind the alias, rather than the display name, but apparently, the display name has spaces that are needed to identify them... In any case, this is where I am stuck...

$mepf     = Get-MailPublicFolder "Pub Folder Name" -ResultSize unlimited
$alias    = $mepf.displayname
$pf       = get-publicfolder -Recurse -ResultSize unlimited | ? {$_.Identity -match "$alias"}
$identity = $pf.Identity
$perms    = Get-PublicFolderClientPermission -Identity $pf.Identity | Where-Object {$_.User -notmatch "Default|Anonymous"} | Select-Object -ExpandProperty User

Solution

  • This looks like it is working... Thanks, Daniel!

    $mepf     = Get-MailPublicFolder "PubFolderName" -ResultSize unlimited
    $alias    = $mepf.displayname
    $pfs      = get-publicfolder -Recurse -ResultSize unlimited | ? {$_.Identity -match "$alias"}
    
    foreach ($pf in $pfs){
    $identity = $pf.Identity
    
    $perms    = Get-PublicFolderClientPermission -Identity $pf.Identity | Where-Object {$_.User -notmatch "Default|Anonymous"} | Select-Object -ExpandProperty User
    

    }