Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Restarts a Virgin Media Suberhub using the web interface.
function Restart-VirginRouter {
<#
.Synopsis
Restarts a Virgin Media Suberhub.
.Description
Restarts a Virgin Media Suberhub using the web interface.
.Parameter RouterIP
The IP address of the router.
.Parameter Username
The username used to log into the web interface.
.Parameter Password,
The password used to log into the web interface.
.Example
Restart-VirginRouter -RouterIP "192.168.0.1" -Username "admin" -Password "hunter2"
Restarts the router using the specified credentials.
.Notes
Ben Neise 23/02/15
#>
param (
[Parameter(
Mandatory = $true,
Position = 1
)]
[string]
$RouterIP,
[Parameter(
Mandatory = $true,
Position = 2
)]
[string]
$Username,
[Parameter(
Mandatory = $true,
Position = 3
)]
[string]
$Password
)
# Login
$loginParams = @{
VmLoginUsername = $username;
VmLoginPassword = $password;
VmLoginErrorCode = 0;
VmChangePasswordHint = 0
}
Invoke-WebRequest -Uri ("http://" + $routerIP + "/goform/VmLogin") -Method "POST" -Body $loginParams -SessionVariable "Session"
# Restart
$restartParams = @{
VmDeviceRestore = 0;
VmDeviceReboot = 1
}
Invoke-WebRequest -Uri ("http://" + $routerIP + "/goform/VmRgRebootRestoreDevice") -Method "POST" -Body $restartParams -SessionVariable "Session"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.