# Changing table values... is it possible?

**URL:** <https://forums.powershell.org/t/changing-table-values-is-it-possible/2232>\
**Category:** PowerShell Help\
**Created:** [January 31, 2014, 1:48am UTC](https://forums.powershell.org/t/changing-table-values-is-it-possible/2232 "2014-01-31T01:48:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vandrey-trindade](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/vandrey-trindade/32/198_2.png) [@vandrey-trindade](https://forums.powershell.org/u/vandrey-trindade)\
**Post date:** [January 31, 2014, 1:48am UTC](https://forums.powershell.org/t/changing-table-values-is-it-possible/2232/1 "2014-01-31T01:48:23Z")

</div>

Hi,

I’m trying to get a table and change some values to display for the user.  
Something like this:

**Original table**

Identity Trustee AccessRights

* * *

list1 luiz {SendAs}  
list1 nayara {SendAs}  
list1 adriana {SendAs}  
list2 rafael {SendAs}  
list2 samuel {SendAs}  
list2 sueli {SendAs}  
list2 thais {SendAs}

**Custom table that I managed to make**

Lista/Caixa Usuário Permissão

* * *

list1 luiz {SendAs}  
list1 nayara {SendAs}  
list1 adriana {SendAs}  
list2 rafael {SendAs}  
list2 samuel {SendAs}  
list2 sueli {SendAs}  
list2 thais {SendAs}

I’m using the command below to get to this table:

`$listas = Get-RecipientPermission | where {($.Trustee -ne ‘nt authority\self’) -and ($.Trustee -ne ‘null sid’)} | select Identity,Trustee,AccessRights | ft @{expression=“Identity”;label=“Lista/Caixa”;width=35},@{expression=“Trustee”;label=“Usuário”},@{Expression=“AccessRights”;label=“Permissão”}`

But I need to change that “{SendAs}” for something like “Enviar como”, to make the table look like this:

**Custom table needed**

Lista/Caixa Usuário Permissão

* * *

list1 luiz Enviar como  
list1 nayara Enviar como  
list1 adriana Enviar como  
list2 rafael Enviar como  
list2 samuel Enviar como  
list2 sueli Enviar como  
list2 thais Enviar como

Is it possible?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [January 31, 2014, 3:47am UTC](https://forums.powershell.org/t/changing-table-values-is-it-possible/2232/2 "2014-01-31T03:47:09Z")

</div>

Yep, it’s possible. The curly braces around {SendAs} indicate that the AccessRights property is an array, and whatever enumerated type is contained in that property will also have other possible values that you’d need to translate. Because it’s an array, you’ll want to use a loop of some sort (probably foreach) to translate each element individually.

Because I’m not sure what type you’re dealing with, I wrote an example to treat everything as strings; you can just add additional values to the $accessRightsTranslations hashtable as needed. This isn’t the most efficient way to go about it, but it does work. Better would be to write a function that works with the enum directly.

```
$accessRightsTranslations = @{
    'SendAs' = 'Enviar como'
}

Get-RecipientPermission | 
Where-Object { ($_.Trustee -ne 'nt authority\self') -and ($_.Trustee -ne 'null sid') } |
ForEach-Object {
    $permission = $_
              
    $accessRights = @()

    foreach ($right in $permission.AccessRights)
    {
        $rightString = [string]$right

        if ($accessRightsTranslations.ContainsKey($rightString))
        {
            $accessRights += $accessRightsTranslations[$rightString]
        }
        else
        {
            $accessRights += $rightString
        }
    }

    New-Object psobject -Property @{
        'Lista/Caixa' = $permission.Identity
        'Usuário' = $permission.Trustee
        'Permissão' = $accessRights
    } | Select-Object 'Lista/Caixa','Usuário','Permissão'
}
```

---

<div class="post-metadata">

**Author:** ![vandrey-trindade](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/vandrey-trindade/32/198_2.png) [@vandrey-trindade](https://forums.powershell.org/u/vandrey-trindade)\
**Post date:** [January 31, 2014, 4:33am UTC](https://forums.powershell.org/t/changing-table-values-is-it-possible/2232/3 "2014-01-31T04:33:54Z")

</div>

Wow Dave!  
Thanks a lot for the quick reply and for helping me!

Worked like a charm =]

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:52pm UTC](https://forums.powershell.org/t/changing-table-values-is-it-possible/2232/4 "2024-05-16T20:52:28Z")

</div>

Closed on May 16, 2024, 8:52pm UTC


