Convert Dynamic IP to static IP in a Windows computer or server
Make sure the Powershell should be opened with elevated privilege $Domain = read-host "Enter the domain name for the DNS Suffix " #Collect Network Configuration variables $IfName = (Get-NetIPInterface -AddressFamily IPv4 -Dhcp Enabled).InterfaceAlias $IfIndex = (Get-NetIPInterface -AddressFamily IPv4 -Dhcp Enabled).ifIndex $IP = (Get-NetIPConfiguration -InterfaceIndex $IfIndex | Select-Object -ExpandProperty IPv4Address).IPv4Address Start-Sleep -Seconds 20 Write-host "IP Address set as: $IP." $Gateway = (Get-NetIPConfiguration -InterfaceIndex $IfIndex | Select-Object -ExpandProperty IPv4DefaultGateway).NextHop Write-host "Gateway set as: $Gateway." $PrefixLength = Get-NetIPAddress -InterfaceIndex $IfIndex | Select-Object -ExpandProperty PrefixLength $DNSServers = @() $DNS = @() $DNS = Get-DnsClientServerAddress -InterfaceIndex $IfIndex | Select-Object -ExpandProperty ServerAddresses foreach($item in $DNS) { $DNSServers += $item } Write-host "S...