Powershell
Script Tracing and Logging https://docs.microsoft.com/en-us/powershell/scripting/wmf/whats-new/script-logging?view=powershell-7
Remote PowerShell $Server01 = New-PSSession -ComputerName Server01
$s1, $s2, $s3 = New-PSSession -ComputerName Server01,Server02,Server03
Rename file
Rename-Item -Path "c:\logfiles\daily_file.txt" -NewName "monday_file.txt"Rename multiple files
Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace '.txt','.LOCKY' }Move file Use the Move-Item cmdlet, instead.
Ping multiple hosts
Test-Connection -Count 1 -TargetName Server01, Server02, Server12Download file and obfuscate Invoke-WebRequest https://secure.eicar.org/eicar.com.txt -OutFile C:\Windows\Temp\test.jar
powershell -WindowStyle Hidden -ExecutionPolicy Bypass -e "SW52b2tlLVdlYlJlcXVlc3QgaHR0cHM6Ly9zZWN1cmUuZWljYXIub3JnL2VpY2FyLmNvbS50eHQgLU91dEZpbGUgQzpcV2luZG93c1xUZW1wXHRlc3QuamFy"
Last updated