# Help adding a new column

**URL:** <https://forums.powershell.org/t/help-adding-a-new-column/18854>\
**Category:** PowerShell Help\
**Created:** [March 18, 2022, 6:59pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854 "2022-03-18T18:59:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiros](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amiros](https://forums.powershell.org/u/amiros)\
**Post date:** [March 18, 2022, 6:59pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854/1 "2022-03-18T18:59:52Z")

</div>

Hello to all,  
I founded a great script that will export all our Office add-ins to a txt file.  
I would like to add another column to the results and know the location of the key (If it’s outlook add-in or word add-in).

```auto
$searchScopes = "HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKCU:\Software\Microsoft\Office\Word\Addins"
$Results = $searchScopes | % {Get-ChildItem -Path $_ | % {Get-ItemProperty -Path $_.PSPath} | Select-Object @{n="Name";e={Split-Path $_.PSPath -leaf}},FriendlyName,Description} | Sort-Object -Unique -Property name
$Results | Out-File "c:\Office addins.txt" -Append

```

What I need to add to make it happen.

Thank you so much  
Amir 🙂

---

<div class="post-metadata">

**Author:** ![random-commandline](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@random-commandline](https://forums.powershell.org/u/random-commandline)\
**Post date:** [March 18, 2022, 7:47pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854/2 "2022-03-18T19:47:55Z")

</div>

If you want your original search scope in results, just add it to a variable down the pipeline like so.

```auto
$searchScopes | ForEach-Object {
$s = $_ ; Get-ChildItem -Path $_ | Get-ItemProperty | 
Select-Object @{n='Name';e={Split-Path $_.PSPath -leaf}},FriendlyName,Description,
@{n='KeyLocation';exp={$s}}} | Sort-Object -Unique -Property name

```

---

<div class="post-metadata">

**Author:** ![amiros](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amiros](https://forums.powershell.org/u/amiros)\
**Post date:** [March 18, 2022, 8:27pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854/3 "2022-03-18T20:27:16Z")

</div>

Thank you for taking the time to answer but the result is the same.  
I took the first variable $searchscopes and added your code.  
What am i missing.

```auto
$searchScopes = "HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKCU:\Software\Microsoft\Office\Word\Addins"
$searchScopes | ForEach-Object {
$s = $_ ; Get-ChildItem -Path $_ | Get-ItemProperty | 
Select-Object @{n='Name';e={Split-Path $_.PSPath -leaf}},FriendlyName,Description,
@{n='KeyLocation';exp={$s}}} | Sort-Object -Unique -Property name

```

Thank you  
Amir

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [March 18, 2022, 9:27pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854/4 "2022-03-18T21:27:22Z")

</div>

I’d bet it is there … 😉

Try to add a

```auto
| Format-List *

```

to the end of your command. 😉 😉 😉

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [March 18, 2022, 11:53pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854/5 "2022-03-18T23:53:51Z")

</div>

@amiros,

you marked the wrong answer as solution!! 👆🏽

The code from @random-commandline is correct. 👆🏽 Just because of the width of the first columns PowerShell does not display it in a console with a common width. 🤷🏽‍♂️

---

<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:18pm UTC](https://forums.powershell.org/t/help-adding-a-new-column/18854/6 "2024-05-16T20:18:08Z")

</div>


