Skip to main content

Test-Battery

SYNOPSISโ€‹

Tests whether the local machine is running on AC power or not.

SYNTAXโ€‹

Test-Battery [-PassThru] [<CommonParameters>]

DESCRIPTIONโ€‹

Tests whether the local machine is running on AC power and returns true/false. For detailed information, use -PassThru option.

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Test-Battery

EXAMPLE 2โ€‹

(Test-Battery -PassThru).IsLaptop

Determines if the current system is a laptop or not.

PARAMETERSโ€‹

-PassThruโ€‹

Outputs a hashtable containing the following properties:

IsLaptop, IsUsingACPower, ACPowerLineStatus, BatteryChargeStatus, BatteryLifePercent, BatteryLifeRemaining, BatteryFullLifetime

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParametersโ€‹

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTSโ€‹

Noneโ€‹

You cannot pipe objects to this function.โ€‹

OUTPUTSโ€‹

System.Hashtable.โ€‹

Returns a hashtable containing the following propertiesโ€‹

- IsLaptopโ€‹

- IsUsingACPowerโ€‹

- ACPowerLineStatusโ€‹

- BatteryChargeStatusโ€‹

- BatteryLifePercentโ€‹

- BatteryLifeRemainingโ€‹

- BatteryFullLifetimeโ€‹

NOTESโ€‹

https://psappdeploytoolkit.com