Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $DedicatedIPPath = ('HKCU:\SOFTWARE\VPNetworkLLC\TorGuard\server-sites\dedicated-ip')
- $DedicatedIPSize = (Get-ItemProperty -Path $DedicatedIPPath |
- Select-Object -ExpandProperty 'Size')
- $RemoveStaleKeys = (Get-ChildItem $DedicatedIPPath |
- Where-Object `
- {
- $_.PSChildname -gt "$DedicatedIPSize"
- } |
- Remove-Item -Force -InformationAction SilentlyContinue)
- $NetflixIPKey = (Get-ChildItem $DedicatedIPPath -Recurse |
- ForEach-Object {Get-ItemProperty -Path Registry::$_} |
- Where-Object {$_.Comment -Contains "Netflix"} |
- Select-Object -First 1)
- $DedicatedIPCount = (Get-ChildItem $DedicatedIPPath -Recurse ).Count
- $NewNetflixIP = (Resolve-Dnsname -DnsOnly -Name 'watch.torguard.org' -Server '8.8.8.8' |
- Select-Object -ExpandProperty 'IP4Address')
- $Registrykeys = @{'Country-Code' = 'USA';
- 'Comment' = 'Netflix';
- 'IP-Address' = "$NewNetflixIP"}
- $TorguardLocation = (Get-ItemProperty -Path ('HKLM:\software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\VPNetwork LLC TorGuard\') |
- Select-Object -ExpandProperty 'InstallLocation').Trim('""') + '\TorguardDesktopQt.exe'
- IF ($DedicatedIPSize -gt 0)
- {
- IF ($NetflixIPKey -eq $Null)
- {
- $DedicatedIPCount++
- New-Item -Path $DedicatedIPPath -Name $DedicatedIPCount -Force | Out-Null
- Set-ItemProperty -Path $DedicatedIPPath -Name Size -Value $DedicatedIPCount -Force | Out-Null
- ForEach ($Value in $Registrykeys.GetEnumerator())
- {
- New-ItemProperty -Path $DedicatedIPPath\$DedicatedIPCount -Name $Value.Name -Value $Value.Value -PropertyType String -Force | Out-Null
- }
- }
- ELSE
- {
- ForEach ($Value in $Registrykeys.GetEnumerator())
- {
- New-ItemProperty -Path $NetflixIPKey.PSPath -Name $Value.Name -Value $Value.Value -PropertyType String -Force | Out-Null
- }
- }
- }
- ELSE
- {
- $DedicatedIPCount++
- New-Item -Path $DedicatedIPPath -Name $DedicatedIPCount -Force | Out-Null
- Set-ItemProperty -Path $DedicatedIPPath -Name Size -Value $DedicatedIPCount -Force | Out-Null
- ForEach ($Value in $Registrykeys.GetEnumerator())
- {
- New-ItemProperty -Path $DedicatedIPPath\$DedicatedIPCount -Name $Value.Name -Value $Value.Value -PropertyType String -Force | Out-Null
- }
- }
- & $TorGuardLocation
Add Comment
Please, Sign In to add comment