locked
How to Output Server Name RRS feed

  • Question

  • I'm trying to pull the Server Names from the below script. the "Get-DCHP" server cmdlet is being used from the PSCX library.  Get-Member shows a PSComputerName property, but the PScomputerName always shows blank.

    $Server = (Get-DhcpServer).ServerName
    foreach ($pc in $Server)
    {  
    Get-DhcpServerv4Scope -ComputerName $pc | ft PSComputerName,ScopeId,SubnetMask,Name,State
    } 

    I would like to view the ComputerName in my output.

    My end result is to view all my DHCP Servers with their respective scope, currently the script only shows me all the scopes but I cant tell what Computer they were pulled from.

    Thursday, October 15, 2015 8:28 PM