amiros
March 18, 2022, 6:59pm
1
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
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
amiros
March 18, 2022, 8:27pm
3
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
Olaf
March 18, 2022, 9:27pm
4
I’d bet it is there …
Try to add a
| Format-List *
to the end of your command.
1 Like
Olaf
March 18, 2022, 11:53pm
5
@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.
1 Like