something exciting

Some information about the exciting thing

Table of contents generated with markdown-toc


param (
    [parameter(ValueFromPipeline = $true,
        ValueFromPipelineByPropertyName = $true)]
    $ComputerName = $env:ComputerName

begin {}
process {
    foreach ($Computer in $ComputerName) {
        if (Test-Connection -ComputerName $Computer -Count 1 -ErrorAction 0) {
            try {
                $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer -ErrorAction Stop | Where-Object { $_.IPEnabled }
            catch {
                Write-Warning "Error occurred while querying $Computer."
            foreach ($Network in $Networks) {
                $IPAddress = $Network.IpAddress[0]
                $SubnetMask = $Network.IPSubnet[0]
                $DefaultGateway = $Network.DefaultIPGateway
                $DNSServers = $Network.DNSServerSearchOrder
                $IsDHCPEnabled = $false
                If ($network.DHCPEnabled) {
                    $IsDHCPEnabled = $true
                $MACAddress = $Network.MACAddress
                $OutputObj = New-Object -Type PSObject
                $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
                $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
                $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
                $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value $DefaultGateway
                $OutputObj | Add-Member -MemberType NoteProperty -Name IsDHCPEnabled -Value $IsDHCPEnabled
                $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value $DNSServers
                $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress

end {}

Back to Top


Please feel free to copy parts of the script or if you would like to download the entire script, simple click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.

Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.


Back to Top