Created
June 3, 2021 15:49
-
-
Save sandeep-sr/4c367d0d07aaed03625f559261968053 to your computer and use it in GitHub Desktop.
powershell - simple powershell operators we can increase the last digits in an IP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Helps in increasing the IP based on the input | |
$IP="10.1.2.3" | |
$split=$IP.Split(".",4) | Select -Index 3 | |
[int]$lastpart=$split | |
$ipnew=($ip.split(".",4)|select -index 0,1,2) -join "." | |
$add=$lastpart+25 | |
$ip25th=$IPnew +"." +$add | |
Write-Output "$ip25th" | |
Output: | |
10.1.2.28 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment