Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking to use powershell and task scheduler in windows 7 ultimate 32 bit to redial vpn should the vpn connection drops. I found a scrip ( ) but it only have one IP address. What I need is a range of IP address like because of the way my vpn assigns IP addresses. Can anyone help me out?

Create c:\pn.ps1 and add the following:

$ip = ""
$result = gwmi -query "SELECT * FROM Win32_PingStatus WHERE Address = '$ip'"
if ($result.StatusCode -eq 0) {
    Write-Host "$ip is up."
    Write-Host "$ip is down."
    Write-Host "Disconnecting..."
    rasdial.exe DegreeVPN /DISCONNECT
    Write-Host "Connecting..."
    rasdial.exe DegreeVPN vpnUsername vpnPassword12345
share|improve this question
What do you want to pass the script? a subnet and an address? – soandos Aug 4 '13 at 4:12
I want to insert IP range so instead of in the scrip above, I want to insert all IPs between to – dreamerman Aug 4 '13 at 7:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.