Email as Encoded Command

# This is the encoded command # Essentially your code wrapped in a string # This sends emails to your gmail account / easily changeable $cmd = '$mailMessage = [System.Net.Mail.MailMessage]::new("", "") $mailMessage.Subject = "Test Email From HTA" $client = [System.Net.Mail.SmtpClient]::new("", 587) $credentials = [System.Net.NetworkCredential]::new("username", "userpassword") $client.Credentials = $credentials $client.EnableSsl = "True" $client.Host = "" $client.Send($mailMessage)' $bytes = [System.Text.Encoding]::Unicode.GetBytes($cmd) $encodedCommand = [Convert]::ToBase64String($bytes) # This is the base 64 string to pass to the encoded command in the HTML file write-host $encodedCommand
Powershell script to get encode for HTA and pass to Powershell

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.