Created
January 21, 2019 21:14
-
-
Save spy86/ed0a7912e92d30164d78c398403e43dc to your computer and use it in GitHub Desktop.
Encode powershell script
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
| $command = 'send-mailmessage -from -to -subject "$env:computername has been restarted" -body "The server $env:computername has recently restarted. If this was unexpected please log into the server and check the cause as soon as possible." -smtpserver ' | |
| $bytes = [system.text.encoding]::Unicode.GetBytes($command) | |
| $encodedCommand = [convert]::tobase64string($bytes) | |
| echo $encodedCommand > encodedtext.txt | |
| notepad encodedtext.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment