{"id":23289360,"url":"https://github.com/izh318/powershell-vpngate","last_synced_at":"2025-06-11T08:38:24.849Z","repository":{"id":268882487,"uuid":"905731795","full_name":"IZH318/PowerShell-VPNGate","owner":"IZH318","description":"A PowerShell script to automate the process of connecting to VPN servers from VPNGate, allowing users to filter servers by country, establish a VPN connection, and verify the connection by checking the IP address.","archived":false,"fork":false,"pushed_at":"2024-12-19T12:50:50.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T17:16:52.040Z","etag":null,"topics":["powershell","powershell-script","vpn","vpngate"],"latest_commit_sha":null,"homepage":"https://www.vpngate.net/en/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IZH318.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-19T12:13:10.000Z","updated_at":"2024-12-19T12:50:54.000Z","dependencies_parsed_at":"2024-12-19T13:50:19.756Z","dependency_job_id":"37ecc17f-df1c-4223-80e2-329f3d1cefb4","html_url":"https://github.com/IZH318/PowerShell-VPNGate","commit_stats":null,"previous_names":["izh318/powershell-vpngate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IZH318%2FPowerShell-VPNGate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IZH318%2FPowerShell-VPNGate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IZH318%2FPowerShell-VPNGate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IZH318%2FPowerShell-VPNGate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IZH318","download_url":"https://codeload.github.com/IZH318/PowerShell-VPNGate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IZH318%2FPowerShell-VPNGate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259231168,"owners_count":22825526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["powershell","powershell-script","vpn","vpngate"],"created_at":"2024-12-20T04:14:04.796Z","updated_at":"2025-06-11T08:38:24.818Z","avatar_url":"https://github.com/IZH318.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerShell-VPNGate\n\n## Overview\n\nThis PowerShell script automates the process of downloading a list of VPN servers from VPNGate, filtering the servers by the selected country, and attempting to connect to a VPN server. Upon a successful connection, it verifies the VPN connection by checking the system's IP address.\n\nThe script is divided into distinct steps:\n1. **Download a CSV file** containing VPN server data from VPNGate.\n2. **Display a list of available countries** from the CSV file for user selection.\n3. **Filter VPN servers** based on the selected country.\n4. **Set up and establish a VPN connection** to one of the filtered servers.\n5. **Verify the VPN connection** by checking the IP address after a successful connection.\n\n## Features\n- **Country-based VPN server filtering**: Users can choose a country, and the script will only show VPN servers from that country.\n- **Automatic VPN connection setup**: The script will check if the desired VPN connection exists and configure it automatically.\n- **IP address verification**: After a successful VPN connection, the script checks the current IP address using both a `Test-Connection` method and an HTTP request to Cloudflare.\n\n## Requirements\n- PowerShell (Windows)\n- VPN connection profile setup rights\n- Internet access for downloading the CSV file and making the VPN connection.\n\n## Installation and Setup\n\n1. **Download the Script**:  \n   Copy and save the script to a `.ps1` file on your system.\n\n2. **Run the Script**:  \n   **Method 1: Right-click the file and select \"Run with PowerShell\"**  \n   - **Run the script with PowerShell**:\n     1. Locate the script file in **File Explorer**.\n     2. Right-click the file and select **\"Run with PowerShell\"**.\n     3. This will open PowerShell and automatically execute the script.\n\n   **Method 2: Open PowerShell as Administrator and run the script**  \n   - **Open PowerShell as Administrator**:\n     1. Search for **PowerShell** in the **Start menu**.\n     2. Right-click **Windows PowerShell** in the search results and select **\"Run as administrator\"**.\n     3. In the PowerShell window, navigate to the folder where the script is saved. For example, if the script is saved in the **C:\\Scripts** folder, use the following command:\n        ```powershell\n        cd C:\\Scripts\n        ```\n     4. Then execute the script with the following command:\n        ```powershell\n        .\\VPNConnectionScript.ps1\n        ```\n\n3. **Execution Policy Change**  \n   When running the script, PowerShell may prompt you with a message asking to change the execution policy. To proceed, simply press **\"Y\"** or **\"A\"** to allow the script to run. This will ensure that the script can be executed without restrictions due to the current execution policy settings.\n   \n4. **Modify VPN Connection Settings (Optional)**:  \n   You can change the VPN connection name, user, password, or VPN tunnel type by editing the following lines in the script:\n   ```powershell\n   $vpnName = \"VPN Gate\"  # Modify the VPN connection name\n   $vpnUser = \"vpn\"       # Modify the VPN user\n   $vpnPassword = \"vpn\"   # Modify the VPN password\n   $vpnTunnelType = \"Automatic\"  # Modify the VPN tunnel type\n   ```\n\n## Script Workflow\n1. **Download VPN Server List**:  \n   The script will download a CSV file from the VPNGate API containing a list of available VPN servers.\n\n2. **Display Country List**:  \n   The script will process the CSV file and display a list of available countries. You can choose a country by inputting the corresponding number.\n\n3. **Filter VPN Servers by Country**:  \n   After selecting the country, the script filters the list of VPN servers to only show those that are located in the chosen country.\n\n4. **VPN Connection Setup**:  \n   The script checks whether a VPN connection already exists. If a matching connection exists, it will attempt to connect using that configuration. If not, it will create a new VPN connection with the selected server.\n\n5. **Verify VPN Connection**:  \n   Once connected, the script checks the system's IP address using two methods:\n   - **Test-Connection**: A standard network ping to an external server (`1.1.1.1`).\n   - **Web Request**: An HTTP request to Cloudflare to obtain the external IP address.\n\n## Sample Output\n```\n---------------------------------------------------------------------------------------------------\n● CSV file download completed\n---------------------------------------------------------------------------------------------------\n---------------------------------------------------------------------------------------------------\n● Country List\n---------------------------------------------------------------------------------------------------\n   1 United States\n   2 United Kingdom\n   3 Germany\n   4 France\n   5 Canada\n---------------------------------------------------------------------------------------------------\n---------------------------------------------------------------------------------------------------\nInput Country (1-5): 1\n---------------------------------------------------------------------------------------------------\n● Filtered Data for Country: United States\n---------------------------------------------------------------------------------------------------\nSelected VPN server list:\nvpn1.opengw.net\nvpn2.opengw.net\nvpn3.opengw.net\n---------------------------------------------------------------------------------------------------\n---------------------------------------------------------------------------------------------------\nNo existing VPN connection. Adding a new one.\n---------------------------------------------------------------------------------------------------\nAdding new VPN connection...\nNew VPN connection added successfully.\n---------------------------------------------------------------------------------------------------\nAttempting to connect to VPN...\nAttempting VPN connection to: vpn1.opengw.net\nVPN connection successful: vpn1.opengw.net\nTime taken: 10 seconds\n---------------------------------------------------------------------------------------------------\nChecking IP address after VPN connection...\nTest-Connection: 192.168.1.1\nCurrent IP address (web request): 192.168.1.1\n---------------------------------------------------------------------------------------------------\nPress Enter to exit\n```\n\n## Troubleshooting\n- **Error: \"Error occurred while downloading the file\"**: This could indicate an issue with internet connectivity or a problem accessing the VPNGate API. Ensure the network is working and try running the script again.\n- **VPN connection issues**: If the connection fails, check the VPN server list and ensure the selected server is available. Verify that the VPN connection settings are correct.\n- **IP address verification**: If the IP check fails, make sure the VPN is properly connected, and there are no network issues preventing the IP verification.\n\n## License\nThis script is released under the MIT License. You are free to modify and distribute it as needed.\n\n## Contributions\nFeel free to fork and contribute to this script. If you encounter any issues, please open an issue on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizh318%2Fpowershell-vpngate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizh318%2Fpowershell-vpngate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizh318%2Fpowershell-vpngate/lists"}