...
https://www.tutorialspoint.com/powershell/index.htm
Enable the script to run | ||||||||
---|---|---|---|---|---|---|---|---|
link | ||||||||
in Powershell | Set-ExecutionPolicy Unrestricted
| |||||||
Hello World | ||||||||
create |
( .ps1 file ) | New-Item script.ps1 -ItemType File >>>> write-host "hello world" |
use ISE | |
run | > "hello world.ps1" or >& '.\hello world.ps1' |
Print out | |
---|---|
write-host "Welcome to my script" | |
Loop for | Link |
Loop while | |
write-host "Welcome to my script" while ($true){ #test-connection 172.16.128.2 } | |
create a ping and curl loop | Invoke-WebRequest |
for ($i=0; $i -lt 30; $i++){ #Start-Process powershell.exe -ArgumentList "ping 172.26.128.2 -n 100 -l 1472" Start-Process powershell.exe -ArgumentList "Invoke-WebRequest 172.26.128.2 -UseBasicParsing" Start-Process powershell.exe -ArgumentList "Invoke-WebRequest 172.26.128.2 -UseBasicParsing" Start-Process powershell.exe -ArgumentList "Invoke-WebRequest 172.26.128.2 -UseBasicParsing" Start-Process powershell.exe -ArgumentList "Invoke-WebRequest 172.26.128.2 -UseBasicParsing" Start-Sleep -Seconds 1 } | |