I know this is an older post, but wanted share a custom inventory that we are using to upgrade Office to X64 that inventories all Microsoft Apps addins. It needs to be ran under the user context to retrieve the HKCU keys. I tweaked the powershell script logic from earlier post to retrieve registry keys that match addin from the Office registry path.
sample output that is inventoried to the Altiris NS
<#
Custom Inventory to retrieve MS Office addin/Plugin information from the registry
#>
FUNCTION REGKEY_UPDATE {
PARAM ($REGKEY)
SWITCH ( $REGKEY) {
{ $_ -MATCH '_USER' } { ($_).replace( "HKEY_CURRENT_USER\","HKCU:\" ) }
{ $_ -MATCH '_MACHINE' } { ($_).replace( "HKEY_LOCAL_MACHINE\","HKLM:\" ) }
}
}
$Office_Bitness = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' -ErrorAction SilentlyContinue).Platform
$OS_Bitness = switch ($((Get-CimInstance Win32_operatingsystem).OSArchitecture)) { "64-Bit" {"x64"} "32-Bit" {"x86"} }
$MSOFFICE_REGKEYS = @("HKLM:\Software\Microsoft\office","HKLM:\Software\Wow6432Node\Microsoft\Office","HKCU:\Software\Microsoft\office","HKCU:\Software\Wow6432Node\Microsoft\Office")
# Retrives MS Office addins info from registry keys from the $MSOFFICE_REGKEYS variable
$MSOFFICE_ADDINS = $MSOFFICE_REGKEYS | % {
(GCI $_ -ErrorAction SilentlyContinue | SELECT NAME | % {
GCI $(REGKEY_UPDATE $_.NAME) } | SELECT NAME | ? {
$_.NAME -MATCH 'ADDINS'} | % {
GCI $(REGKEY_UPDATE $_.NAME) | % {
Get-ItemProperty (REGKEY_UPDATE $_.NAME) } |
SELECT @{N="Office App";E={ (($_.PSParentPath -split "Office")[1]) -replace "\\Addins","" -replace "\\","" }},
@{N="PluginName";E={ $_.FriendlyName }}, @{N="Plugin";e={$_.pschildname}} , Description,
@{N="Bitness";E={ $Office_Bitness }}, LoadBehavior,
@{N="Registry Path";E={ REGKEY_UPDATE (($_.PSParentPath -split "::")[1]) }}
}
)
}
$MSOFFICE_ADDINS | ? { $_.LoadBehavior -NE $NULL } | FT
$nse = New-Object -comobject "Altiris.AeXNSEvent"
$nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
$nse.Priority = 1
# Create a new inventory data row to send to the NS
$invDataClass = $nse.AddDataClass("{6b763f2e-bffe-4703-ae83-6b7059411003}") ## REPLACE WITH Your DATACLASS
$invDataBlock = $nse.AddDataBlock($invDataClass)
$MSOFFICE_ADDINS | ? { $_.LoadBehavior -NE $NULL } | % {
# init the row data
$invDataRow = $invDataBlock.AddRow()
$invDataRow.SetField(0, $_.PluginName)
$invDataRow.SetField(1, $_.Plugin)
$invDataRow.SetField(2, $_.Description)
$invDataRow.SetField(3, $_.'Office App')
$invDataRow.SetField(4, $_.Bitness)
$invDataRow.SetField(5, $_.LoadBehavior)
$invDataRow.SetField(6, $_.'Registry Path')
}
try{
# send the data to the NS
$nse.SendQueued()
}
catch [System.Exception]{
Write-Warning "Unable to send the inventory data block to the NS. $($Error[0])"
exit 3
}
Original Message:
Sent: Aug 05, 2015 10:58 AM
From: Migration User
Subject: Custom Inventory
Hi there, we are going to be doing a MS Office 2013 upgrade within our environment. I have been asked to create a custom inventory to capture the MS Outlook Addins that are currently installed on the Win 7 workstations prior to the 2013 upgrade.
I've been looking through the forums for something that I could reuse but can't seem to find anything and am having a hard time trying to modify some of the samples.
Can anybody help me out?
I need to capture the keys that exist under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins with the Description and FriendlyName for each of those subkeys.
Ideally the results returned would indicate the machine name and then list the additional fields below.
AddIn Name :BCSAddin.Connect
FriendlyName :Business Connectivity Services Add-In
Description :This Add-in is used by Business Connectivity Services.