none
DHCP statistics using classic WMIC. Is there any way to do it? RRS feed

  • Question

  • Hello,

    That sounds great while using PowerShell from windows machines, but... what about  WQL queries? is this method deprecated?

    I've found no way to retrieve DHCP statistics using classic WMIC. Is there any way to do it?

    Thanks

    • Split by jrv Wednesday, January 16, 2019 3:15 PM Better forum
    Wednesday, January 16, 2019 2:12 PM

All replies

  • WMI requires 2012 or later.

    Always consult the documentation for this kind of question:

    https://docs.microsoft.com/en-us/previous-versions/windows/desktop/dhcpserverpsprov/ps-dhcpserverv4scopestatistics


    \_(ツ)_/



    • Edited by jrv Wednesday, January 16, 2019 2:36 PM
    Wednesday, January 16, 2019 2:34 PM
  • > WMI requires 2012 or later.

    ??

    I suppose you're referring about WMI section of DHCP server though, that's fine. But I'm still no capable to make a simple WQL query to get for instance PercentageInUse from DhcpServerv4ScopeStatistics without using Powershell nor cmdlets.

    Is any example query? something like:

    select * from DhcpServerv4ScopeStatistics

    In the same way I can get information from Win32_OperatingSystem:

    Request: "SELECT Caption FROM Win32_OperatingSystem"

    Response:

    CLASS: Win32_OperatingSystem
    Caption
    Microsoft Windows Server 2016 Standard Evaluation


    Thank you

    Wednesday, January 16, 2019 3:09 PM
  • That is not how that provider works.  Read the whole threa

    The place to ask or learn how to use DHCP is the DHCP forum.  You also should not add new questions to other users closed and answered posts.


    \_(ツ)_/


    • Edited by jrv Wednesday, January 16, 2019 3:12 PM
    Wednesday, January 16, 2019 3:12 PM
  • Hi,

    You may try the following commands:

    Get-WmiObject -Namespace ROOT\Microsoft\Windows\DHCP -List
    
    Get-WmiObject -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics'
    
    (Get-WmiObject -ComputerName DHCPSERV01 -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get()
    
    (Get-WmiObject -ComputerName DHCPSERV01 -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get() | Select-Object -ExpandProperty cmdletOutput
    
    (Get-WmiObject -ComputerName DHCPSERV01 -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get() | Select-Object -ExpandProperty cmdletOutput | Select-Object __SERVER,ScopeId,SuperscopeName,AddressesInUse,AddressesFree
    
    (Get-WmiObject -ComputerName DHCPSERV01 -Namespace ROOT\Microsoft\Windows\DHCP -List | Where-Object Name -eq 'PS_DhcpServerv4ScopeStatistics').Get() | Select-Object -ExpandProperty cmdletOutput | Select-Object __SERVER,ScopeId,SuperscopeName,AddressesInUse,AddressesFree,PercentageInUse | Format-Table -AutoSize

     

    Reference:

    https://social.technet.microsoft.com/Forums/en-US/66210404-e80c-4077-987f-84f8fc92eac8/monitor-dhcp-server-statistics-via-wmi?forum=winserverpowershell

    Regards,

    Zoe

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, January 18, 2019 2:14 AM
  • Hi,

     

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

     

    Best Regards,

    Zoe


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, January 21, 2019 9:04 AM
  • Hi,

     

    Was your issue resolved?

    If the information provided was helpful, please "mark it as answer" to help other community members find the helpful reply quickly.

    If no, please reply and tell us the current situation in order to provide further help.

     

    Best Regards,

    Zoe


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, January 23, 2019 8:29 AM
  • Hi,

    As this thread has been quiet for a while, we will propose the solution as answer. If you need further help, please feel free to reply this post directly so we will be notified to follow it up. You can also choose to unpropose the answer as you wish.

    BTW, we'd love to hear your feedback about the solution. By sharing your experience, you can help other community members facing similar problems. Thanks for your understanding and efforts.

    Best Regards,

    Zoe


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, January 28, 2019 2:27 AM