# ファイル名: Export-DefaultPrograms.ps1
$pcName = $env:COMPUTERNAME
$logPath = "$pcName`_default.log"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content $logPath "`n[$timestamp] 既定のプログラム一覧の出力開始"
# レジストリキーを取得
$extsPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts'
$exts = Get-ChildItem $extsPath
foreach ($ext in $exts) {
$userChoicePath = "$extsPath\$($ext.PSChildName)\UserChoice"
if (Test-Path $userChoicePath) {
$progId = (Get-ItemProperty $userChoicePath).ProgId
Add-Content $logPath "$($ext.PSChildName) => $progId"
}
}
$timestampEnd = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content $logPath "[$timestampEnd] 出力完了"
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme