· 6 years ago · Apr 18, 2019, 08:02 PM
1$url = "www.yandex.ru"
2
3
4$Network = Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPEnabled}
5$IPAddress = $Network.IpAddress[0]
6$SubnetMask = $Network.IPSubnet
7$DefaultGateway = $Network.DefaultIPGateway
8$DNSServers = $Network.DNSServerSearchOrder
9$MACAddress = $Network.MACAddress
10$DHCPServer = $Network.DHCPServer
11
12
13"Task 1" | Out-File result.txt
14"IPAddress: " | Out-File result.txt -Append -NoNewline
15$IPAddress| Out-File result.txt -Append
16"SubnetMask: " | Out-File result.txt -Append -NoNewline
17$SubnetMask | Out-File result.txt -Append
18"DefaultGateway: " | Out-File result.txt -Append -NoNewline
19$DefaultGateway | Out-File result.txt -Append
20
21"`nTask 2" | Out-File result.txt -Append
22"MAC Addrees: " | Out-File result.txt -Append -NoNewline
23$MACAddress | Out-File result.txt -Append
24
25"`nTask 3" | Out-File result.txt -Append
26Test-Connection $DHCPServer | Out-File result.txt -Append
27
28"`nTask 4" | Out-File result.txt -Append
29"DefaultGateway: " | Out-File result.txt -Append
30Test-Connection $DefaultGateway | Out-File result.txt -Append
31"URL: " | Out-File result.txt -Appenda
32Test-Connection $url | Out-File result.txt -Append
33
34"`nTask 5" | Out-File result.txt -Append
35& "C:\Program Files\WindowsPowerShell\Scripts\Speedtest.ps1" | Out-File result.txt -Append
36
37$url = "yandex.ru"
38"`nTask 6" | Out-File result.txt -Append
39ping -n 1 -r 3 $url| Out-File result.txt -Append
40
41"`nTask 7" | Out-File result.txt -Append
42tracert yandex.ru| Out-File result.txt -Append
43
44"`nTask 8" | Out-File result.txt -Append
45pathping $url| Out-File result.txt -Append
46
47"`nTask 9" | Out-File result.txt -Append
48arp -a | Out-File result.txt -Append
49
50"`nTask 10" | Out-File result.txt -Append
51netstat | Out-File result.txt -Append
52
53"`nTask 10" | Out-File result.txt -Append
54ping $url -f -l 1472 | Out-File result.txt -Append
55
56"`nFINISH!!!" | Out-File result.txt -Append