dhcp_check.ps1 - michael-D-S/SYS-265 GitHub Wiki
- Get the current logged-in user $user = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
- Get network adapter configuration using WMI $networkAdapter = Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Where-Object { $_.IPEnabled -eq $true }
- Retrieve the relevant details $ipv4Address = $networkAdapter.IPAddress[0] $dhcpServer = $networkAdapter.DHCPServer $gateway = $networkAdapter.DefaultIPGateway[0] $dnsServers = $networkAdapter.DNSServerSearchOrder -join ', '
- Output network information Write-Host "------ Network Information ------" Write-Host "User: $user" Write-Host "IPv4 Address: $ipv4Address" Write-Host "DHCP Server IP: $dhcpServer" Write-Host "Gateway IP: $gateway" Write-Host "DNS Servers: $dnsServers" Write-Host "---------------------------------"
⚠️ **GitHub.com Fallback** ⚠️