Advertisement
Guest User

D2-Solo

a guest
Nov 26th, 2020
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
  2. if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
  3. $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
  4. Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
  5. Exit
  6. }
  7. }
  8.  
  9. $rule = Get-NetFirewallRule -DisplayName "Destiny2-1" 2> $null;
  10. if ($rule) {
  11. Remove-NetFirewallRule -DisplayName "Destiny2-1";
  12. } else {
  13. New-NetFirewallRule -DisplayName "Destiny2-1" -Direction Outbound -RemotePort 27000-27200,3097 -Protocol TCP -Action Block;
  14. }
  15. $rule = Get-NetFirewallRule -DisplayName "Destiny2-2" 2> $null;
  16. if ($rule) {
  17. Remove-NetFirewallRule -DisplayName "Destiny2-2";
  18. } else {
  19. New-NetFirewallRule -DisplayName "Destiny2-2" -Direction Outbound -RemotePort 27000-27200,3097 -Protocol UDP -Action Block;
  20. }
  21. $rule = Get-NetFirewallRule -DisplayName "Destiny2-3" 2> $null;
  22. if ($rule) {
  23. Remove-NetFirewallRule -DisplayName "Destiny2-3";
  24. } else {
  25. New-NetFirewallRule -DisplayName "Destiny2-3" -Direction Inbound -RemotePort 27000-27200,3097 -Protocol TCP -Action Block;
  26. }
  27. $rule = Get-NetFirewallRule -DisplayName "Destiny2-4" 2> $null;
  28. if ($rule) {
  29. Remove-NetFirewallRule -DisplayName "Destiny2-4";
  30. } else {
  31. New-NetFirewallRule -DisplayName "Destiny2-4" -Direction Inbound -RemotePort 27000-27200,3097 -Protocol UDP -Action Block;
  32. }
  33.  
  34. Write-Host "Successful, stay safe Guardian."
  35. Write-Host "Press any key to exit"
  36. $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement