Skip to content

Instantly share code, notes, and snippets.

@NicmeisteR
Last active June 29, 2025 14:53
Show Gist options
  • Save NicmeisteR/55eb23a702e88d746a818f3b5c2943d6 to your computer and use it in GitHub Desktop.
Save NicmeisteR/55eb23a702e88d746a818f3b5c2943d6 to your computer and use it in GitHub Desktop.
Halo Infinite Login Fix
# Define the specific credential prefix to delete
$CredentialPrefix = 'Xbl|2043073184'
# Get raw output directly as string array
$rawOutput = & cmdkey.exe /list | Out-String -Stream
# Show what we're looking for
Write-Host "Looking for credentials starting with: '$CredentialPrefix'" -ForegroundColor Yellow
# Better parsing of cmdkey output with more flexible pattern matching
$Credentials = @()
foreach ($line in $rawOutput) {
# Try multiple patterns to ensure we catch the credentials
if ($line -match "Target:\s*(.+)$" -or $line -match "^(Xbl\|[^\s]+)") {
$potentialTarget = $matches[1].Trim()
# Check with case-insensitive comparison and more flexible matching
if ($potentialTarget -like "*$CredentialPrefix*") {
$Credentials += $potentialTarget
Write-Host "Found matching credential: '$potentialTarget'" -ForegroundColor Green
}
}
}
# If no credentials found, try an alternative approach
if ($Credentials.Count -eq 0) {
Write-Host "No matches found with primary method, trying alternative approach..." -ForegroundColor Yellow
$targetLines = $rawOutput | Select-String -Pattern "Target:" -SimpleMatch
foreach ($line in $targetLines) {
$targetText = $line.ToString() -replace ".*Target:\s*", ""
if ($targetText -like "*$CredentialPrefix*") {
$Credentials += $targetText
Write-Host "Found matching credential with alternative method: '$targetText'" -ForegroundColor Green
}
}
}
# Log the number of matching credentials found
Write-Host "Total matching credentials found: $($Credentials.Count)" -ForegroundColor Yellow
# Delete each matching credential
foreach ($Credential in $Credentials) {
Write-Host "Attempting to delete credential: '$Credential'" -ForegroundColor Cyan
try {
$deleteResult = cmdkey.exe /delete:$Credential
$deleteResult | Out-Host
# Double-check with explicit syntax
if ($deleteResult -notlike "*successfully*") {
Write-Host "Trying alternative delete syntax..." -ForegroundColor Yellow
$deleteResult = cmdkey.exe /delete:"$Credential"
$deleteResult | Out-Host
}
}
catch {
Write-Host "Error deleting credential: $_" -ForegroundColor Red
}
}
Write-Host "Deletion process complete." -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment