This repository was archived by the owner on Aug 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtruphone_datausage.ps1
More file actions
48 lines (35 loc) · 1.56 KB
/
truphone_datausage.ps1
File metadata and controls
48 lines (35 loc) · 1.56 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$URL = "https://business.truphone.com/Authentication/Login"
$ie = New-Object -comobject InternetExplorer.Application -Property @{
Navigate = $url
Visible = $false
Silent = $true
}
do { Start-Sleep -m 100 } while ( $ie.ReadyState -ne 4 )
$ie.Document.getElementById("Email").value = "your_username"
$ie.Document.getElementById("Password").value = "your_password"
do { Start-Sleep -m 500 } while ( $ie.ReadyState -ne 4 )
$login = $ie.Document.documentElement.getElementsByClassName("btn btn-lg btn-primary") | Select-Object -First 1
$login.click()
do { Start-Sleep -m 5000 } while ( $ie.ReadyState -ne 4 )
$body = "dataUsage: " + $ie.Document.getElementById("dataUsage").outertext.trim() + "`n"
$array = $ie.Document.getElementById("freeMinutes").outertext.Split("`r`n")
$body = $body + "freeMinutes: "
foreach ($line in $array) {
$body = $body + $line
}
$body = $body + "`n"
$array1 = $ie.Document.getElementById("inbundleMinutes").outertext.Split("`r`n")
$body = $body + "inbundleMinutes: "
foreach ($line in $array1) {
$body = $body + $line
}
$body = $body + "`n"
$body = $body + "textsSent: "+ $ie.Document.getElementById("textsSent").outertext.trim() + "`n"
$EmailFrom = "x@y.z" #Summary Email Sender Address
$EmailTo = "x@y.z" #Summary Email Receiver
$EmailSubject = "Truphone Status" #Summary Email Subject
$SMTPServer = "x.x.x.x" #Mail Server Address
Send-MailMessage -SmtpServer $SMTPServer -From $EmailFrom -To $EmailTo -Subject $EmailSubject -Body $body.trim()
$ie.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($ie) | out-null
Remove-Variable ie