Outlook Script for Accounts

I am looking for help to create a script to pull any accounts that have been added to an outlook profile.
Then to have the output either emailed when ran or added to a custom field on the device profile page in syncro.
I would like the script to be based on installation of Outlook and not consider AD or AAD joins.


If (Test-Path 'hkcu:\Software\Microsoft\Office\15.0\Outlook\Profiles') {
	$regPath = 'hkcu:\Software\Microsoft\Office\15.0\Outlook\Profiles\*\9375CFF0413111d3B88A00104B2A6676\*'
}elseif(Test-Path 'hkcu:\Software\Microsoft\Office\16.0\Outlook\Profiles'){
	$regPath = 'hkcu:\Software\Microsoft\Office\16.0\Outlook\Profiles\*\9375CFF0413111d3B88A00104B2A6676\*'
	Write-Host 'Outlook not found'

Get-ItemProperty  $regPath |
	Where{$_.'Account Name' -notmatch 'Outlook Address Book|Outlook Data File'} |
	Select @{n= 'ComputerName';e={$env:COMPUTERNAME}},@{n= 'UserName';e={$env:USERNAME}}, 'Account Name' |
	Export-Csv $logFile