Ad Widget

Collapse

Windows 2012 R2 DHCP monitor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sunrise0318
    Junior Member
    • Feb 2017
    • 24

    #1

    Windows 2012 R2 DHCP monitor

    Hy all.

    Please help me how to monitor dhcp scope.

    I use snmp monitor but after restart not work.

    Thank you answer.
  • Sunrise0318
    Junior Member
    • Feb 2017
    • 24

    #2
    Windows DHCP Server PS Work

    Hy all.

    I create windows dhcp server viewer.

    Its work.
    Attached Files

    Comment

    • Sunrise0318
      Junior Member
      • Feb 2017
      • 24

      #3
      PS DHCP SERVER Zabbix Autodiscover

      Hy All

      I create new script for dhcp server.
      The program discover dhcp scope but value data not work.
      Code:
      Code:
      param(
          [Parameter(Mandatory=$False)]
          $QueryName,
          $ScopeID
      )
      
      
      #$dhcp_PercentageInUse = Get-DhcpServerv4ScopeStatistics | Select PercentageInUse | Format-Table -HideTableHeaders -AutoSize
      if ($QueryName -eq '') { 
      $result = @{}
      $result.data = @()
      $dhcp_data = (Get-WmiObject -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get()  |Select-Object -ExpandProperty cmdletOutput| Select-Object ScopeId 
      $dhcp_data = $dhcp_data -replace "ScopeID="
      $dhcp_data = $dhcp_data -replace "@"
      $dhcp_data = $dhcp_data -replace "{"
      $dhcp_data = $dhcp_data -replace "}"
      
          foreach ($dhcp in $dhcp_data) {
                  #$result.ScopeID = $result.ScopeID -replace "value"
              
              #$objItem.ScopeID = $objItem.ScopeID -replace "}\\","`+"
              #$objItem.ScopeID = $objItem.ScopeID -replace "\\","/"
      #        $line =  " { `"{#FSNAME}`":`"" + $objItem.ScopeID + "`" , `"{#FSUSAGE}`":`"" + $objItem.PercentageInUse + "`" },"
              $result.data +=  @{ "{#SCOPEID}"=$dhcp}
          }
          $result | ConvertTo-Json
         
      }
      else
      {
          $ScopeID = (Get-WmiObject -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get()  |Select-Object -ExpandProperty cmdletOutput| Select-Object ScopeId 
          $ScopeID = $ScopeID -replace "ScopeID="
          $ScopeID = $ScopeID -replace "@"
          $ScopeID = $ScopeID -replace "{"
          $ScopeID = $ScopeID -replace "}"
          switch ($ScopeID)
              {
             #('Capacity') {$Results = gwmi win32_volume -Filter "name = '$FSName'" | select Capacity | Format-Table -HideTableHeaders -AutoSize}
              ('PercentageInUse') {$Results = (Get-WmiObject -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get($ScopeID)  |Select-Object -ExpandProperty cmdletOutput| Select-Object PercentageInUse | Format-Table -HideTableHeaders -AutoSize }
              #default {$Results = "No data Found"}
        
              }  
          $Results = $Results | Out-String
          $Results = $Results.trim("\n")
          Write-Host $Results  
         
        }
      This program add 1 scope ID more data from scopes.

      Please help me.

      Thank you
      Last edited by Sunrise0318; 14-03-2017, 16:00.

      Comment

      Working...