Skip to content

Instantly share code, notes, and snippets.

@zinntikumugai
Created March 8, 2026 07:34
Show Gist options
  • Select an option

  • Save zinntikumugai/983dd4c028a86c40ee4cedd579b78ce3 to your computer and use it in GitHub Desktop.

Select an option

Save zinntikumugai/983dd4c028a86c40ee4cedd579b78ce3 to your computer and use it in GitHub Desktop.

e-taxソフトでインストール失敗したときに消すヤツ

管理者権限でPowerShellを起動して実行

powershell -NoProfile -ExecutionPolicy Bypass -File .\etaxrm.ps1
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
param()
$ErrorActionPreference = 'Stop'
function Test-IsAdministrator {
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentIdentity)
return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}
if (-not (Test-IsAdministrator)) {
throw "Run this script in an elevated PowerShell session."
}
if (-not [Environment]::Is64BitOperatingSystem) {
throw "This script requires a 64-bit Windows OS."
}
$targets = @(
@{
Type = 'Registry'
Path = 'HKLM:\SOFTWARE\Wow6432Node\nta'
Label = 'HKLM\SOFTWARE\Wow6432Node\nta'
},
@{
Type = 'Directory'
Path = 'C:\Program Files (x86)\etax'
Label = 'C:\Program Files (x86)\etax'
},
@{
Type = 'Directory'
Path = 'C:\Program Files (x86)\InstallShield Installation Information\{1ECF5EFF-BCDE-484C-A0A8-E4A86FEA3B59}'
Label = 'C:\Program Files (x86)\InstallShield Installation Information\{1ECF5EFF-BCDE-484C-A0A8-E4A86FEA3B59}'
}
)
Write-Host 'Checking targets...' -ForegroundColor Cyan
foreach ($target in $targets) {
$exists = Test-Path -LiteralPath $target.Path
if ($exists) {
Write-Host "[FOUND] $($target.Label)" -ForegroundColor Yellow
}
else {
Write-Host "[SKIP ] $($target.Label) (not found)" -ForegroundColor DarkGray
}
}
Write-Host ''
Write-Host 'Starting removal...' -ForegroundColor Cyan
foreach ($target in $targets) {
if (-not (Test-Path -LiteralPath $target.Path)) {
continue
}
if ($PSCmdlet.ShouldProcess($target.Label, 'Remove')) {
Remove-Item -LiteralPath $target.Path -Recurse -Force
Write-Host "[DONE ] $($target.Label)" -ForegroundColor Green
}
}
Write-Host ''
Write-Host 'Completed.' -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment