You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PowerShell获取Windows 10本地Outlook 2007配置文件的用户名与邮箱

Extracting Outlook 2007 Username and Email Address with PowerShell

Hey there! For Outlook 2007 on Windows 10, your profile data (including usernames and email addresses) lives in the Windows Registry. Here's a PowerShell script that pulls this info from your default profile, with error handling to cover common edge cases:

# Retrieve the default Outlook 2007 profile name from the registry
$defaultProfilePath = "HKCU:\Software\Microsoft\Office\12.0\Outlook\Profiles\DefaultProfile"
try {
    $defaultProfileName = Get-ItemPropertyValue -Path $defaultProfilePath -Name "(Default)" -ErrorAction Stop
}
catch {
    Write-Error "Failed to find default Outlook 2007 profile. Is Outlook installed and configured on this machine?"
    exit 1
}

# Navigate to the profile's main registry key
$profileRoot = "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\$defaultProfileName"
if (-not (Test-Path $profileRoot)) {
    Write-Error "Profile registry path not found: $profileRoot"
    exit 1
}

# Locate account-specific subkeys (Outlook 2007 uses this GUID for account settings)
$accountKeys = Get-ChildItem -Path "$profileRoot\9375CFF0413111d3B88A00104B2A6676" -ErrorAction SilentlyContinue | 
               Where-Object { $_.PSChildName -match "^0000000" }

if (-not $accountKeys) {
    Write-Error "No email accounts found in the default Outlook profile."
    exit 1
}

# Extract and format username/email pairs
$outlookAccounts = foreach ($key in $accountKeys) {
    $accountProps = Get-ItemProperty -Path $key.PSPath
    
    [PSCustomObject]@{
        Username      = $accountProps."Account Name"
        EmailAddress  = $accountProps."Email Address"
    }
}

# Display results
Write-Host "Found Outlook 2007 Accounts:" -ForegroundColor Cyan
$outlookAccounts | Format-Table -AutoSize

Quick Notes:

  • Permissions: No admin rights needed here—we're only accessing the HKCU (Current User) registry hive.
  • Non-Default Profiles: If you need to target a specific non-default profile, replace $defaultProfileName with the exact name of your desired profile.
  • Account Compatibility: This works for most standard account types (Exchange, POP3, IMAP) in Outlook 2007. Specialized configurations might store data in different keys, but this covers the majority of use cases.

内容的提问来源于stack exchange,提问作者Malik Ismaeel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:10:44