Tag Archive: powershell

Feb 27

Execute local scripts in PowerShell

I run into this all the time. I install PowerShell, go to run a .ps1 script and it yells at me saying that the script is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details… To fix it you'll need to execute this command: Set-ExecutionPolicy RemoteSigned …

Continue reading »

Dec 03

Powershell Spamming Machine

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 …

Continue reading »

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 …

Continue reading »