Skip to content

Instantly share code, notes, and snippets.

@koukuko
Last active December 16, 2019 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koukuko/2013ded4c9d7ed4a8c935a93a002b78c to your computer and use it in GitHub Desktop.
Save koukuko/2013ded4c9d7ed4a8c935a93a002b78c to your computer and use it in GitHub Desktop.
让FF14弹90002错误的脚本,使用前先使用管理员权限的powershell运行`set-executionpolicy remotesigned`,并同意。右键选择“使用 Powershell”运行,即可让FF14弹出90002错误,再运行一次就可以恢复正常。
# Add NetFirewallRule for FF14
# @author koukuko
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
exit;
}
Add-Type -AssemblyName PresentationCore,PresentationFramework;
# check rule exist
$RuleDisplayName = "FF14_90002";
$Rule = Get-NetFirewallRule -DisplayName $RuleDisplayName 2> $null;
if ($Rule) {
Remove-NetFirewallRule -DisplayName $RuleDisplayName;
[System.Windows.MessageBox]::Show('<Final Fantasy XIV> block rule has been deleted.');
exit;
}
# check process exist
$FF14ProcessName = "ffxiv";
$FF14Process = Get-Process $FF14ProcessName -ErrorAction SilentlyContinue;
if (!$FF14Process) {
$FF14ProcessName = "ffxiv_dx11";
$FF14Process = Get-Process $FF14ProcessName -ErrorAction SilentlyContinue;
}
# process not found
if (!$FF14Process) {
[System.Windows.MessageBox]::Show('Please run the script after launching <Final Fantasy XIV>.');
exit;
}
$FF14Path = $FF14Process | Select-Object -ExpandProperty Path;
New-NetFirewallRule -DisplayName $RuleDisplayName -Direction Outbound -Program $FF14Path -Action Block;
[System.Windows.MessageBox]::Show('<Final Fantasy XIV> has been blocked.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment