Jump to content

Add all live IP's to Notifications


dbeckwitt
 Share

Recommended Posts

I've written a script to scan the network and insert all existing active IP addresses to the proper location in the registry, however Pulseway manager doesn't pick that up (even on service restart).
Where do I need to insert those changes?

Sample script below- It relys on a txt file for a list of active IP's (generated separately)

 

cls
# Remove any existing registry entries
$ExistingKeys = Get-ChildItem "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\" | Select-Object -expand Name
$Count = 0
ForEach ($Key in $ExistingKeys){
  Remove-Item "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count"
  $Count++
 }

#Load List of IP's to monitor and insert values into registry
$IPList = Get-Content "C:\updates\IPList.txt"
$Count = 0;
foreach ($IP in $IPList) {
    New-Item "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count";
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("Address") -Type String -Value $IP;
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("AliasName") -Type String -Value "Camera $Count";
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("Priority1") -Type String -Value 2;
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("Priority2") -Type String -Value 1;
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("ResponseMinutes") -Type String -Value 1;
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("ResponseTime") -Type String -Value 300;
    Set-ItemProperty -Path "HKLM:\Software\MMSOFT Design\PC Monitor\DevicesPingResponses\Device$Count" -Name ("UseAlias") -Type String -Value 0;
    $Count++
    
    }

exit 0;

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...