Help adding a new column

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).

$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 :slight_smile:

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

$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
2 Likes

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.

$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

I’d bet it is there … :wink:

Try to add a

| Format-List *

to the end of your command. :wink: :wink: :wink:

1 Like

@amiros,

you marked the wrong answer as solution!! :point_up_2:t4:

The code from @random-commandline is correct. :point_up_2:t4: Just because of the width of the first columns PowerShell does not display it in a console with a common width. :man_shrugging:t4:

1 Like