< Back

Get-Modem

Sat Jan 18, 2020 4:18 pm

NAME Get-Modem



SYNOPSIS

Display GPRS online activity from selected date.





SYNTAX

Get-Modem [-eap <String>] [-next <String>] [-_tag <String>] [-disconn <String>] [-connect <String>] [-limit

<Int32>] [-after <String>] [[-month] <String>] [-adjust <String>] [-today] [-count <Int32>] [-download <Double>]

[-upload <Double>] [-device <String>] [-pattern <String>] [<CommonParameters>]





DESCRIPTION

The Get-Modem cmdlet scans the Internet Explorer Event log for events relating to GPRS online activity,

specifically

events 5003 (Connect) and 5004 (Disconnect), generated via Huawei USBs; a Balloon Tip appearing in the Navigation

area when the SIM card has 5 days remaining before expiry.



It is necessary to install the Network Monitor Service (from the website below) as this writes an event 300 to the

Internet Explorer Event Log whenever offline status is detected with details of the data transmitted and Adapter

in

use.





PARAMETERS

-eap <String>



Required? false

Position? named

Default value $errorActionPreference

Accept pipeline input? false

Accept wildcard characters? false



-next <String>



Required? false

Position? named

Default value 5004

Accept pipeline input? false

Accept wildcard characters? false



-_tag <String>

We need a DISCONNECT event to start with. Otherwise ONLINE.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-disconn <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-connect <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-limit <Int32>



Required? false

Position? named

Default value 30

Accept pipeline input? false

Accept wildcard characters? false



-after <String>



Required? false

Position? named

Default value $env:dtac

Accept pipeline input? false

Accept wildcard characters? false



-month <String>



Required? false

Position? 1

Default value 00/00/0000

Accept pipeline input? false

Accept wildcard characters? false



-adjust <String>

Format will be checked before use.



Required? false

Position? named

Default value 00:00:00

Accept pipeline input? false

Accept wildcard characters? false



-today [<SwitchParameter>]

Format will be checked before use.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-count <Int32>



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-download <Double>



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-upload <Double>



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-device <String>



Required? false

Position? named

Default value Adapter: Remote NDIS*

Accept pipeline input? false

Accept wildcard characters? false



-pattern <String>

Input must end with * here.



Required? false

Position? named

Default value ^.*(?<adapter>Adapter: .*\\)).*= -?(?<down>(\\d+\\W\\d+)).*= -?(?<up>(\\d+\\W\\d+)).*$

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Twenty five days after the date set with the -Month switch, a reminder message will appear in the

Notification Area and will reappear each day until the 30 days has expired. Additionally, whenever

the -Verbose switch is in use, this will also indicate the day when the SIM will expire and the

number of days until then (NOTE: these messages can always be suppressed by resetting the default

'-Limit' from 30 to a larger number).



If an -Adjust value is to be permanently added, an Alias function can be included to accomplish this:

function GPRS {

Invoke-Expression "Get-Modem -Adjust 01:01:01 $args"

}

This must also be included in the Manifest FunctionsToExport = 'GPRS'



The -Device parameter may be used to select download/upload data from a different device; the default

being 'Adapter: Remote NDIS*'. Note the final '*' as a wildcard character.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-Modem -After 23/10/2017 -Verbose



Display GPRS online activity from selected date. Shows all online times since 23/10/2017

with individual entries displayed. In the rare cases of Connect and Disconnect events not

being logged in the IE Event Log, the former will be suffixed with '#' and the latter with

'*' in any -Verbose display; these times therefore not being 100% accurate.



PS D:\\Scripts> Get-Modem -After 23/10/2017 -Verbose

VERBOSE: Command activation - User [Peter] Computer [SEA3-W12GOLNKFB]

VERBOSE: Network Monitor - Running

Calculating total connect time of all GPRS modem devices...

VERBOSE: Disconnect at: 25/10/2009 18:55:50. Online - 00:45:56 minutes

VERBOSE: Connect at: 25/10/2009 18:09:54.

VERBOSE: Disconnect at: 25/10/2009 13:52:55. Online - 00:30:32 minutes*

VERBOSE: Connect at: 25/10/2009 13:22:23.

VERBOSE: Disconnect at: 24/10/2009 19:19:56. Online - 00:33:53 minutes

VERBOSE: Connect at: 24/10/2009 18:46:03.

VERBOSE: Disconnect at: 24/10/2009 13:48:03. Online - 00:11:12 minutes

VERBOSE: Connect at: 24/10/2009 13:36:51.

VERBOSE: Disconnect at: 24/10/2009 13:30:56. Online - 00:20:08 minutes#

VERBOSE: Connect at: 24/10/2009 13:10:48.

Total online usage since Monday 23 October 2017 is 02:21:41 hours (7 Mb).

VERBOSE: Data values: Download = 5.716 Mb, Upload = 1.175 Mb (Sessions = 5)

VERBOSE: SIM card will expire in 28 days on Wednesday, 29 November 2017









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-Modem -Today



Lists entries for today only and also invokes the Verbose switch for more detail

(NOTE: should both the -Today and -After parameters be used together, the former will

always take preference).



PS D:\\Scripts> Get-Modem -Today

VERBOSE: Command activation - User [Peter] Computer [SEA3-W12GOLNKFB]

VERBOSE: Network Monitor - Running

Calculating total connect time of all GPRS modem devices...

VERBOSE: Disconnect at: 06/11/2009 20:43:22. Online - 00:25:47 minutes

VERBOSE: Connect at: 06/11/2009 20:17:35.

Total online usage for today Friday 06 November 2009 is 00:25:47 minutes (0 Mb).

VERBOSE: Data values: Download = 0.000 Mb, Upload = 0.000 Mb (Sessions = 1)

VERBOSE: SIM card will expire in 25 days on Wednesday, 29 November 2017









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-Modem -Hours 2:20:00



Add or subtract an extra amount of time to or from the total. For example, if the

same SIM card has had time deducted when used on another computer. To subtract an

amount of time just use a leading '-': Get-Modem -Hours -01:10:00 in this case.



PS D:\\Scripts> Get-Modem -Hours 2:20:00

Calculating total connect time of all GPRS modem devices...

Total online usage since Tuesday 03 November 2009 is 10:20:54 hours (7 Mb).

(including 02:20:00 hours adjustment time)









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-Modem -Month 15/11/2017



Reset the default monthly date. Note that it will be necessary to restart the current

PowerShell session to activate this new date. Any dates after today will be invalid.



PS D:\\Scripts> Get-Modem -Month 15/11/2017

WARNING: [Get-Usb] Creating new default GPRS (Monthly) search date

New default GPRS (Monthly) search date created for: 15/11/2017. Restart PowerShell to activate.











RELATED LINKS

Http://www.SeaStar.co.nf





CommonParameters : False

WorkflowCommonParameters : False

details : @{name=gprs; noun=; verb=}

Syntax : @{syntaxItem=System.Object[]}

parameters : @{parameter=System.Object[]}

inputTypes : @{inputType=}

returnValues : @{returnValue=}

aliases : None



remarks : None

alertSet :

description :

examples :

Synopsis :

gprs



ModuleName : modem

nonTerminatingErrors :

xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10

xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10

xmlns:maml : http://schemas.microsoft.com/maml/2004/10

Name : gprs

Category : Function

Component :

Role :

Functionality :