print message if no battery detected

This commit is contained in:
2024-02-27 11:09:13 -05:00
parent 09fdfa5109
commit 098c590084
+1 -1
View File
@@ -1,5 +1,5 @@
# Exit this script if the current device doesn't have a built-in battery
If ( $null -eq (Get-CimInstance -ClassName Win32_Battery -ErrorAction SilentlyContinue) ) { Exit }
If ( $null -eq (Get-CimInstance -ClassName Win32_Battery -ErrorAction SilentlyContinue) ) { Microsoft.Powershell.Utility\Write-Output "This endpoint does not have a battery" ; Exit }
# Define file paths
$Today = Get-LongDate