-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpppoe.ps1
35 lines (27 loc) · 827 Bytes
/
pppoe.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# PowerShell script to simulate connecting and disconnecting using rasdial
while ($true) {
# For exiting the script
if ($Host.UI.RawUI.KeyAvailable) {
$key = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown").Character
if ($key -eq "q") {
Write-Host "Exiting the script and closing PowerShell."
exit
}
}
# Connect
Write-Output "Connecting..."
$username = ""
$password = ""
rasdial $username $password
Write-Output "Connected."
# Wait for 20 minutes
Write-Output "Waiting for 20 minutes..."
Start-Sleep -Seconds 1200
# Disconnect
Write-Output "Disconnecting..."
rasdial /DISCONNECT
Start-Sleep -Seconds 3
Write-Output "Disconnected."
# Print a msg
Write-Output "Press 'q' to exit the script."
}