Another scripting day…I'm now a spammer! $MyReader = new-object System.IO.StreamReader("C:message.txt"); $message = $MyReader.ReadToEnd(); $MyReader.Close(); #$message = Get-Content -encoding UTF8 -path C:email.txt foreach ($user in Get-Content C:names.txt) { $smtp = new-object Net.Mail.SmtpClient("mail.myserver.com") $smtp.Send("Me <me@email.com>", "$user", "Subject", $message) } The script …
Category: scripting
Nov 01
(No title)
I made a PowerShell script today. It copies only the most recent file in one directory to another directory and e-mails me a simple status report. Let me show you the script… gci c:source | sort LastWriteTime -desc | select -first 1 | cpi -dest c:destination -ea SilentlyContinue -ev copyerr if($copyerr.count -gt 0) { $smtp …
Jul 06
Perl scripts use ENV variables to store data
Today I learned that quries are sent to perl scripts thorugh environment variables. For example, the part of the URL past the ? is stored in the QUERY_STRING environment variable and can be accessed like this… $ENV{'QUERY_STRING'}