A command-line tool for managing VPN and network shares (on Windows) from UPV (Universitat Politècnica de València), built in Rust.
- Setup UPV's VPN configuration on Windows easily via CLI (
upv vpn create <NAME>
) - Mount and unmount your personal UPV network drive (colloquially known as "Disco W")
- Automatically open the drive after mounting
- Force unmount even if files are in use
- Built-in
open
command to directly open mounted drives - Fast and lightweight — no GUI required
- Friendly for PowerShell, CMD, and other shells
⚠️ Important: This tool is only available for Windows, since it uses Windows-specific features likenet use
andrasdial
.
📝 Note: After installing, the binary should be available as
upv
(the file isupv.exe
).
If you use Scoop, you can install upv-cli
by adding my personal bucket with the following commands:
scoop bucket add algono https://github.com/algono/scoop-algono
scoop install upv-cli
You can download the latest release's binary file from the GitHub Releases page.
Click here to directly download the latest release: upv-cli latest release.
Just download the upv.exe
file, place it in a directory that's in your PATH
, and you're good to go!
Note: Requires Rust and Cargo installed. If you don't have them, follow the Rust installation guide.
If you have cargo installed, you can install it from crates.io:
cargo install upv-cli
Or from source after cloning the repository:
git clone https://github.com/algono/upv-cli
cd upv-cli
cargo install --path .
Make sure ~/.cargo/bin
is in your PATH
.
upv vpn create UPV --connect
upv drive mount myuser UPVNET -d W -o
# Create and connect to a VPN named "UPV"
upv vpn create UPV --connect
# Mount the UPV network drive (Disco W) using VPN credentials for the user "myuser" in the "UPVNET" domain to drive W, and then open it from File Explorer
upv drive mount myuser UPVNET -d W -o
upv <command> [options]
upv vpn create "My UPV Connection" --connect
upv vpn create "UPV Work" -c # Short flag for --connect
upv vpn connect "My UPV Connection"
upv vpn disconnect
upv vpn delete "My UPV Connection"
upv vpn delete "UPV Work" --force # Skip confirmation
upv vpn list
upv vpn purge # Delete all UPV connections (with double confirmation)
upv vpn purge --force # Delete all UPV connections without confirmation
upv vpn purge --except "Keep This" # Delete all except specified connections
upv vpn purge -e "VPN1" -e "VPN2" # Delete all except VPN1 and VPN2
upv vpn status
upv drive mount myuser UPVNET --drive W --open # Uses VPN credentials
upv drive mount myuser UPVNET --password mypass --drive W --open # Uses explicit credentials
upv drive mount myuser ALUMNO -d W -o # Short flags, uses VPN credentials
upv drive mount myuser ALUMNO -p mypass -d W -o # Short flags with password
upv drive unmount --drive W
upv drive status
upv completions powershell # Generate PowerShell shell completions script
upv completions powershell > upv-completions.ps1 # Save PowerShell shell completions script to a file
Use --help
to see available options:
upv --help
upv vpn --help
upv drive --help
upv-cli
supports shell auto-completions for various shells thanks to the upv completions
command.
In the following instructions, we focus on PowerShell, but you can adapt them for other shells like Bash or Zsh.
As of writing, the clap_complete
library supports the following shells:
- Bash
- Elvish
- Fish
- PowerShell
- Zsh
For more information, check out the clap_complete library documentation.
If they add more shells in the future, feel free to open an issue or PR to update
clap_complete
's version in this project, and also update the README including those shells in the list.
You have two easy ways to enable completions:
Add this line to your PowerShell profile ($PROFILE
), so completions load dynamically every time you open a new shell:
Invoke-Expression (& upv completions powershell | Out-String)
If you want to make it so it only runs when upv
is available, you can add this instead:
if (Get-Command upv -ErrorAction SilentlyContinue) {
Invoke-Expression (& upv completions powershell | Out-String)
}
This runs the completions command at startup and loads the completions script in memory, always matching the current version of the tool. It adds a tiny bit of startup overhead but requires zero manual updates.
If you prefer faster shell startup and don't want to run the completion generator every time:
- Generate the completions file and save it somewhere (e.g.,
~\upv-completions.ps1
):
upv completions powershell > $HOME\upv-completions.ps1
- Add this line to your PowerShell profile (
$PROFILE
) to load the saved completions script:
. $HOME\upv-completions.ps1
Now your completions load instantly, but you'll need to regenerate the file manually if you update upv
.
The upv
command returns the following exit codes:
0
: Success
These errors are common to all commands and indicate general issues:
1
: General error (the program failed)2
: Invalid command or argument (parsing error)
These errors are specific to the upv-cli
tool and typically indicate issues with VPN or drive operations:
10
: Generic upv-cli error11
: VPN error12
: Drive error13
: Drive in use error (files or folders are open on the drive)
Clone the repo and run locally:
git clone https://github.com/algono/upv-cli
cd upv-cli
cargo run -- <your-args>
Note: Requires Rust and Cargo installed. If you don't have them, follow the Rust installation guide.
If you want to create a new version, remember to update the version in Cargo.toml
before building.
Publish the new version to crates.io:
cargo publish
- Build the project in release mode:
cargo build --release
- Generate hash for the latest release:
$hash = (Get-FileHash -Path .\target\release\upv.exe -Algorithm SHA256).Hash.ToLower()
$hash > .\target\release\upv.exe.sha256
Then, upload both the upv.exe
and upv.exe.sha256
files from target/release/
to the GitHub Releases page (for this repo, that would be at: https://github.com/algono/upv-cli/releases/new).
If you own any Scoop bucket targeting this tool (such as scoop-algono), the update the upv-cli.json
manifest must be updated.
That could happen automatically if you have a GitHub Action that updates the manifest (such as Excavate
from the Scoop Bucket Template) running on a schedule. You can also manually trigger the GitHub Action to update the manifest.
Note that the Excavate GitHub Action will only work if the manifest is properly configured with
checkver
andautoupdate
fields.
You can also update the manifest manually, by changing the version
, url
and hash
fields in the upv-cli.json
manifest file, and then committing and pushing the changes to your bucket repository.
This is an example of the upv-cli.json
manifest file, extracted from the scoop-algono bucket:
{
"version": "0.4.0",
"description": "A CLI tool for managing VPN and network shares from UPV (Universitat Politècnica de València) on Windows.",
"homepage": "https://github.com/algono/upv-cli",
"license": "MIT OR Apache-2.0",
"url": "https://github.com/algono/upv-cli/releases/download/v0.4.0/upv.exe",
"hash": "cc800b5f6a67328581010670b54aa9c0857d7f0b9faec0b3fec47c7162620b9b",
"bin": "upv.exe",
"checkver": "github",
"autoupdate": {
"url": "https://github.com/algono/upv-cli/releases/download/v$version/upv.exe",
"hash": {
"url": "$url.sha256"
}
}
}
Licensed under either of:
at your option.
This tool was developed by Alejandro Gómez (algono) to simplify VPN and network drive access for students and staff at UPV.
⚠️ Notice: The tools mentioned here are no longer maintained, and may contain some outdated features
For a GUI solution, check out: AccesoUPV