APC UPS for Home and Office Forum
Support forum to share knowledge about installation and configuration of APC offers including Home Office UPS, Surge Protectors, UTS, software and services.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-06-10 08:29 AM
Using PCPE, you could go to the following registry entry, HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\APC\PowerChute Personal Edition\3.1.0, select the TechnicalData node and obtain the model number and serial number of the device being monitored by the software.
Knowing that, I was able to create scripts to help maintain data in Excel about my fleet.
Can anyone tell me where PCSS keeps this same information, because I cannot find it?
Thanks!
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-12-13 11:42 AM . Last Modified: 2024-12-17 10:57 AM
Using the latest ChatGPT 4.o model, I have refined @BillP original code snippet:
# GetAPCDeviceInfo
#
# Obtain device Model and Serial number from the APC PCSS log
#
$computername = $env:computername
Write-Output "Current System '$computername'"
$location = "C:\Program Files\APC\PowerChute Serial Shutdown\agent\log\pcss.log"
$search4 = "Device detected!!"
# Read the log file and find the last line containing "Device detected!!"
$lastDetectedLine = Get-Content $location |
Where-Object { $_ -match $search4 } |
Select-Object -Last 1
# Regex pattern to capture the model number after "model:" and remove any trailing comma or spaces
$modelPattern = 'model:\s*([^,]+)' # This will capture the model number up to the first comma or space
# Regex pattern to capture the serial number after "serial num:" and remove any trailing comma or spaces
$serialPattern = 'serial num:\s*([^,]+)' # This will capture the serial number up to the first comma or space
# Check if the lastDetectedLine matches the model pattern
if ($lastDetectedLine -match $modelPattern) {
$modelNumber = $matches[1] # Extracted model number
Write-Output "The model number is: $modelNumber"
} else {
Write-Output "Model number not found."
}
# Check if the lastDetectedLine matches the serial pattern
if ($lastDetectedLine -match $serialPattern) {
$serialNumber = $matches[1] # Extracted serial number
Write-Output "The serial number is: $serialNumber"
} else {
Write-Output "Serial number not found."
}
Hope that helps someone!
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-06-12 05:25 AM
You can query the pcss.log file for the information using PowerShell.
Run the command
Select-String -Path C:"\Program Files\APC\PowerChute Serial Shutdown\agent\log\pcss.log" -pattern 'Back-UPS' (The command is entered assuming PowerChute has been installed to the default path.)
You will also find the information in the About.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-06-12 11:34 AM
@BillP - This sample is significant help. Of course I'm going to have to change all of my existing scripts, but...
I'm going to suggest that the -pattern value should be 'Device detected!!' because not everyone will be using a Back-UPS device.
Also, I changed your sample to the following:
$location = "C:\Program Files\APC\PowerChute Serial Shutdown\agent\log\pcss.log"
$search4 = "Device detected!!"
Get-Content $location |
Where-Object { $_ -match $search4 } |
Select-Object -Last 1
This will get the last entry in the log file with the most current serial number.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-12-13 11:42 AM . Last Modified: 2024-12-17 10:57 AM
Using the latest ChatGPT 4.o model, I have refined @BillP original code snippet:
# GetAPCDeviceInfo
#
# Obtain device Model and Serial number from the APC PCSS log
#
$computername = $env:computername
Write-Output "Current System '$computername'"
$location = "C:\Program Files\APC\PowerChute Serial Shutdown\agent\log\pcss.log"
$search4 = "Device detected!!"
# Read the log file and find the last line containing "Device detected!!"
$lastDetectedLine = Get-Content $location |
Where-Object { $_ -match $search4 } |
Select-Object -Last 1
# Regex pattern to capture the model number after "model:" and remove any trailing comma or spaces
$modelPattern = 'model:\s*([^,]+)' # This will capture the model number up to the first comma or space
# Regex pattern to capture the serial number after "serial num:" and remove any trailing comma or spaces
$serialPattern = 'serial num:\s*([^,]+)' # This will capture the serial number up to the first comma or space
# Check if the lastDetectedLine matches the model pattern
if ($lastDetectedLine -match $modelPattern) {
$modelNumber = $matches[1] # Extracted model number
Write-Output "The model number is: $modelNumber"
} else {
Write-Output "Model number not found."
}
# Check if the lastDetectedLine matches the serial pattern
if ($lastDetectedLine -match $serialPattern) {
$serialNumber = $matches[1] # Extracted serial number
Write-Output "The serial number is: $serialNumber"
} else {
Write-Output "Serial number not found."
}
Hope that helps someone!
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.