
Ping Multiple Addresses In a Loop on Windows
PowerShell Get FSMO List
Dig on Windows
cURL on Windows
Ping Multiple Addresses In a Loop on Windows \_(ʘ_ʘ)_/
for /L %i in (0) do ping -n 10 <GATEWAY IP> & ping -n 10 ping <WAN GATEWAY> & ping -n 10 google.com & ping -n 10 8.8.8.8 & ping -n 10 blog.travisrunyard.us # EXAMPLE: for /L %i in (0) do ping 10.10.10.1 & ping 47.156.0.1 & ping google.com & ping 8.8.8.8 & ping blog.travisrunyard.us # PowerShell instead of cmd.exe: cmd.exe /C "for /L %i in (0) do ping 10.10.10.1 & ping 47.156.0.1 & ping google.com & ping 8.8.8.8 & ping blog.travisrunyard.us" # test-connection cmdlet in PowerShell: $destination = "8.8.8.8", "4.2.2.1", "104.31.72.34" while($true){ test-connection $destination -count 1 -EA 0 -BufferSize 100 -OutBuffer 5 | Select Address,IPv4Address,ResponseTime sleep -MilliSeconds 5000 } # There are other more reliable methods of using ping such as the .Net class, WMI and CIM $Timeout = 100 $Name = "blog.travisrunyard.us" $Ping = New-Object System.Net.NetworkInformation.Ping $Response = $Ping.Send($Name,$Timeout) Write-Host "Common output:" Write-Host "Resonse time (ms): " $Response.RoundtripTime Write-Host "IPv4 Address: "$Response.Address.IPAddressToString Write-Host "Success/Timed out?: "$Response.Status Write-Host "Detailed output:" $Response.Address
PowerShell: Get List of FSMO Role Holders
Get-ADDomain | Select-Object InfrastructureMaster, RIDMaster, PDCEmulator Get-ADForest | Select-Object DomainNamingMaster, SchemaMaster Get-ADDomainController -Filter * | Select-Object Name, Domain, Forest, OperationMasterRoles | Where-Object {$_.OperationMasterRoles} | Format-Table -AutoSize
Dig Command on Windows
Don’t you feel like something is missing when you come from working on Linux for a while then switch back to Windows? These tips will make your command prompt feel a little more like the Bash shell:
Dig – you can still use dig on Windows and it’s extremely easy. Simply visit the Internet Systems Consortium’s site and download the latest stable version of Bind for your architecture of Windows (usually x64). Run the install but only install the Tools. This will install the executable for dig at this location C:\Program Files\ISC BIND 9\bin\dig.exe. Now all you have to do is point your environmental variables to look at that directory. You can download the script here or just copy and paste the two lines below:
$CurrentValue = [Environment]::GetEnvironmentVariable(“Path”, “Machine”) [Environment]::SetEnvironmentVariable(“Path”, $CurrentValue + “;C:\Program Files\ISC BIND 9\bin”, “Machine”)
After you’ve completed those steps you can run dig queries once you’ve opened a new command window:
C:\Windows\system32>dig @8.8.8.8 dc.ads.linkedin.com +noall +answer ; <<>> DiG 9.10.4-P2 <<>> @8.8.8.8 dc.ads.linkedin.com +noall +answer ; (1 server found) ;; global options: +cmd dc.ads.linkedin.com. 3443 IN CNAME data-collector-linkedin-prod-1517996000.us-west-2.elb.amazonaws.com. data-collector-linkedin-prod-1517996000.us-west-2.elb.amazonaws.com. 49 IN A 54.214.29.160 data-collector-linkedin-prod-1517996000.us-west-2.elb.amazonaws.com. 49 IN A 54.244.118.198 data-collector-linkedin-prod-1517996000.us-west-2.elb.amazonaws.com. 49 IN A 54.244.90.67 data-collector-linkedin-prod-1517996000.us-west-2.elb.amazonaws.com. 49 IN A 54.244.225.250
cURL Command on Windows
Download cURL here or use this direct link then throw it in Windows directory. Try querying ipinfo.io for your public IP address.
C:\>curl ipinfo.io { "ip": "47.155.5.100", "city": "Huntington Beach", "region": "California", "country": "US", "loc": "33.6603,-117.9990", "org": "AS5650 Frontier Communications of America, Inc.", "postal": "92648" } C:\>curl ipinfo.io/ip 47.155.5.100