Skip to content

Instantly share code, notes, and snippets.

@Mara-Li
Last active December 18, 2025 20:22
Show Gist options
  • Select an option

  • Save Mara-Li/784fccb3b6841667afd2e4b10434744d to your computer and use it in GitHub Desktop.

Select an option

Save Mara-Li/784fccb3b6841667afd2e4b10434744d to your computer and use it in GitHub Desktop.
# You shouldn't need to modify this unless you have a custom launcher install
$LauncherPath = Join-Path $env:LOCALAPPDATA "XIVLauncher\XIVLauncher.exe"
# change this to the key in 1password
$VaultItemName = "FFXIV"
function Get-OtpFrom1Password {
param([Parameter(Mandatory)][string]$ItemName)
$psi = [System.Diagnostics.ProcessStartInfo]::new()
$psi.FileName = "op"
$psi.Arguments = "item get `"$ItemName`" --otp"
$psi.UseShellExecute = $false
$psi.CreateNoWindow = $true
$psi.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
$p = [System.Diagnostics.Process]::Start($psi)
$out = $p.StandardOutput.ReadToEnd().Trim()
$err = $p.StandardError.ReadToEnd().Trim()
$p.WaitForExit()
if ($p.ExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($out)) {
throw "op failed (exit $($p.ExitCode)): $err"
}
return $out
}
try {
$OTP = Get-OtpFrom1Password -ItemName $VaultItemName
} catch {
# pas de Read-Host dans un exe GUI
[System.Windows.Forms.MessageBox]::Show($_.Exception.Message, "XIVLauncher OTP", "OK", "Error") | Out-Null
exit 1
}
if ($OTP.Length -eq 6) {
# Lance directement le launcher (PAS powershell.exe)
Start-Process -FilePath $LauncherPath
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
Start-Sleep -Seconds 1
try {
Invoke-WebRequest -Uri "http://127.0.0.1:4646/ffxivlauncher/$OTP" -UseBasicParsing | Out-Null
} catch { }
} else {
[System.Windows.Forms.MessageBox]::Show("OTP invalide: '$OTP'", "XIVLauncher OTP", "OK", "Error") | Out-Null
exit 1
}
image

Or use :

ps2exe ".\automatic_login.ps1" "XIVLauncher.exe" -noConsole -icon ".\dalamud.ico" -title "XIVLauncher" -STA -noOutput -noError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment