Powershell SMTP mail sending script

by smthng 30. October 2007 12:46

Let's get back into the techie side of things for just a bit...

At the office, we've been plagued by a really weird Exchange server issue and I've needed to do some "testing" after multiple attempts to fix it.  I wanted a quick and easy method for sending out test messages on a regular basis and I managed to whip up a really simple powershell script to get the job done...  here it be:

$i = 0
$msgNum = read-host -prompt "Enter number of messages to send"
[int]$msgTime = read-host -prompt "How long to wait between messages (minutes)"
$msgSecs = $msgTime * 60
$sc= new-object Net.Mail.SmtpClient -arg "YourServerName"
for ( $i = 1 ; $i -le $msgNum; $i++ ) {
    $time = Get-Date -f "HH:mm:ss"
    write-host "About to send a message at" $time
    $sc= new-object Net.Mail.SmtpClient -arg "YourServerName"
    $sc.Send("me@myaddress.com","destination@siteaddress.com",$time,"Here be a message.")
    Write-host "I've sent" $i "messages so far.  Now sleeping for" $msgTime "minutes."
    Write-host "           ----------------"
    start-sleep -s $msgSecs
}

Here's the quick and dirty on this...  You need to have the SMTP service installed and working on the server you specify.  Change both of the YourServerName entries to match the server that has the SMTP service.  Change the me@myaddress.com to an address that you want to send the message from (it needs permission to send in Exchange and SMTP), change the destination@siteaddress.com to the address you want to send to (in our case, it was a large distribution list).  Run the script.  It'll make a message and send it off.  The subject will be the time (in the format of hh:mm:ss) and the body will be "Here be a message" (you can change that if you like).  It will loop the number of times you specify and it will pause for the number of minutes you enter between each message. 

It's not elegant, nor efficient, but it get's the job done quickly and easily. If you enter bogus numbers to freak out the script, it will happily let you and your results will be unpredictable.  But, if you enter numbers that make sense, it'll work just fine.

It took me a while to track down the whole Net.Mail.SmtpClient stuff, so I figured I'd post it up here in case anyone else needs it.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

blog

CS 2007 upgrade status

by smthng 18. October 2007 11:05

Hey again...  This will probably not be of interest to most.  I'm just putting it here so Dave (the CS guy who helped me out yesterday) can get an idea of where we are if he wants to help me with the upgrade attempt again.

First, a real quick run-down on the upgrade and what happened...  I am running Community Server 2.1 right now, hosted on a shared Windows system, with the database on SQL 2000.  Yesterday, I upped the ASP.Net from 1.1 to 2.0.  I ran the schema update scripts against the SQL databases to bring them up to ASP.Net 2.0 (no problems).  I then attempted to run the 2.1 to 3.0 upgrade scripts.  That's where I started getting Access Denied messages against SQL.  It looks like the last schema update didn't complete, which is probably what killed everything else.  We backed it all out, restored SQL, ASP and my directory and that brings us up to yesterday afternoon.

Last night, I called in to GoDaddy and asked them to move my database over to 2005.  Of course, the answer was "you can't do that".  In other words, it's technically possible, but either they didn't want to or don't know how.  Anyway...  I made a new empty database and verified that it did indeed get created on a 2005 system.  I was then surprised that it allowed me to restore my database from the 2000 backup I did last night.  I checked the 2005 restored stuff and it all seems to be there, but there might be one or two problems that I'll probably need Dave to work on with me...

I have the Schema object under the DB, which was not visible on the 2000 DB.  However, there are now TWO schemas that I think CS might be looking for.  I don't think it's a great idea to go posting my database names for the world to see, so we'll call them Old_DB and New_DB for now.  On the SQL 2005 DB (New_DB) there are a bunch of schema tables, but there are two in particular that concern me when it comes to Community Server.  Within the schema tree, I now see Old_DB and New_DB as schema tables... makes sense, because the new one was built when I made the DB and the old one would have been created by the restore.

So... do the CS scripts care?  Are they doing to pick up the DB and schema names from somewhere or is it a setting I can configure?  Basically, can I convince all the CS scripts to use the old schema table on the new DB?  We shall see... hopefully you'll not be seeing too much cat today. ;)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

blog

Sandisk Sansa Express for Podcast listeners - first thoughts

by smthng 16. October 2007 14:53

Hey again... yes, it's the THIRD post by me today.  I'm on a roll, go figure.

I picked up my Sandisk Sansa Express the other day and have been messing around with it.  It's more "bump proof" than my Zune and it doesn't require any funky software, which are the main two reasons I got it. But, it does have some minor issues and I thought I'd pass them along for anyone who's interested.

First, I gotta give props out to AnythingButIpod.com for having a good review of the thing in the first place.   It's pretty much what convinced me to go with that one over a few others.  But, there are a few things that they didn't mention that are important to me... and might have convinced me to go with another unit had I known.

The first issue I found right off the bat...  when you power the thing off, it doesn't remember where you were in whatever you were listening to.  Not a big deal if you're in the middle of a four minute song, but it's a major issue if you're 20 minutes into a 1 hour podiobook.  That kind of bites.  Unfortunately, that also immediately brought the second issue to my attention...

The fast forward is SLOW!  Not the worst I've seen, but I've seen MUCH better. :(  In an attempt to fix this, I decided to see if there was a firmware update. Result?   The third issue...

The firmware update tool doesn't work.  After dinking with it for way too long on three different computers (one of which blue-screened), I managed to get it to work once.  It went out, checked for an update and told me there wasn't one.  Nice.  As of now, the firmware of 01.01.01A2 is current.  If that saved one person from trying to go through the process of getting that silly updater to work, I've done a very good thing.  You're welcome.

Other than those three bits... so far, I like the Express.  I don't "worry" about it like I do with the Zune.  I can toss it in the tank bag or in a pocket with keys and it's no big deal if the back of it gets scratched.  It does what it does and not much else.  It's relatively simple, easy to use and it can take an extra 2GB microSD card.  I'll probably bug Sandisk to see if they can address the issues above in the next firmware update, but otherwise, I'm good with it. 

L8r!

Oh... almost forgot...  All this stands a slim chance of "going away" soon.  I've pretty much convinced myself that I should attempt upgrading Community Server sometime soon, and I'm guessing that GoDaddy's server is gonna barf on me.  Hopefully, I can get it all in there nice and happy like, but there's a chance I'll nuke it.  I *might* convince myself to copy and paste all my entries just to make sure I have them somewhere... but I kind of doubt I'll be that industrious before I decide to jump in head first.  Hey, at least I'm realistic about myself.  ;)

Rly L8r!

Tuesday, October 16, 2007 5:53 PM

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

blog

Got helmet?

by smthng 16. October 2007 14:36

Hey again... I know, I know... two posts in one day?!?  smthng must be wrong in the world.  ;)

I'm on a local motorcycle mailing list, and it's normally full of drivel.  But, today there was actually smthng posted that I feel like passing along.  If you really want to know what list, ask me and I'll tell ya.  I don't want to post it because I know the spam bots will be all over it like white on rice.  Suffice to say, it's based around Washington DC, so if you live in Idaho, don't worry about it.

Anyway, there was a post about an advertisement that targets motorcyclists.  Specifically it targets helmet use (or lack thereof).  Anyone who's had a bike, been around bikers, whatever... has probably heard the arguement and legislation issues revolving around wearing helmets.  Certain "organizations" are wholeheartedly against helmet laws (for those not familiar with motorcycle issues, this means that there are a lot of bikers who do NOT want to wear helmets).  They get a lot of press, they get a lot of face time on TV and in newspapers, etc.  But, we rarely hear anything about the reasons to wear a helmet, other than the usual political drivel about how much it will raise insurance, how much it will "burden the state", yada, yada, yada.

Well, this one takes a different tack and drives the point home to the individual.  I thought it was pretty cool and hope to see it on televisions all over the place.  It's a message that needs to be heard.  Check it out on Street Anatomy.

Tuesday, October 16, 2007 5:36 PM

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

blog

Back... for now.

by smthng 16. October 2007 12:46

Well, if any of you did try to get to the site today, you are probably aware that I hosed it completely.  Sorry 'bout that.

I don't even really need to tell you, since I'm still going ahead with upgrading the site, which will probably mean you'll be seeing a bit more of the cat until I'm done.  Much thanks go to Dave for doing some exploratory surgery and convincing me to roll back the site and attempt it again later (no link for Dave yet, I'll ask him if he wants me to post one about him later).  Anyway... if you're seeing this at all, things are relatively back to normal... for now.

;)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

blog

New blog spam

by smthng 15. October 2007 09:20

Ho hum...  another round of spammers have tagged me.  No big deal, it shouldn't affect you...  I simply don't publish anything that isn't worthwhile.

I did think this was kind of interesting though, so let me spill the basic premise to you. 

Just like you can leave comments on my blog entry, other bloggers can as well.  I got a notification that a couple of my recent entries have comments so I checked them out.  Basically they are "pingbacks", which are a somewhat enhanced version of "trackbacks".  A blogger copies the trackback link of one of my blog entries and posts it on their blog.  They enter some non-specific gibberish about how they thought the article was cool and supply the link.  Of course, the rest of their site is loaded with advertising and pop-ups.  The text often looks smthng like this:

I came across this post - General Stuff - and thought it was worth sharing. I hope you find it interesting too and take the time to read some of the other articles on their site.

Their blogging software sends a message to my blogging software telling it that there's a trackback.  My software converts that to a comment, and waits for me to publish it. In a reasonable society, it makes sense that our blogs have smthng in common...  which is why someone would link to me in the first place.  So, why not share?  Well, I (being the good blogger manager that I am), go check the other guys blog to find it's basically junk.  So I nuke the comment and you, dear reader, are none the wiser.  Spammers are foiled again!

You might actually be surprised by how much spam my blog gets.  It's rather ridiculous, especially considering that only a handful of people ever find me.  Anyway...

I know there are some other bloggers (and wanna-be bloggers - as soon as you install some decent software, you know who you are) so I figured I'd pass this along.  If you have a blog, don't automatically accept comments and verify what you're posting.  You've been warned.

BTW... you might be interested to know that "pingbacks" were created to help avoid blog spam.  Now, it just means that your spam will come from another blog instead of a dedicated web page.

Monday, October 15, 2007 12:20 PM

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

blog

General stuff

by smthng 10. October 2007 06:26

Hrm... got just a few things I feel like posting up here today.

We'll start with a comment by none other than Seth Harwood himself!  On my blog, no less.  Where, you ask?  Well, go find it yerself!  I'll give you a hint...  It's the most popular and linked entry on this thing (I know, that's not saying much, but it should be fairly obvious to any who frequent my little abode).  For those who don't know who Seth Harwood is... he's a podcaster, crime novelist and an all around cool guy.  Go clicky on the link above if you want to know more (warning - some of his stuff is not safe for rugrats or the office).

Hrm... what else.  Oh yeah!  The Amondotech / light debacle is over... they sent me my stuff.  The coolest part about that whole thing was watching the Jeep club guys when I gave them the lights.  It very quickly turned into a bunch of grown men acting like 12 year olds blinding each other.  Always good entertainment there.  B)

Work is currently a nightmare.  We've got a really strange Exchange issue that no one (including the SEVEN support reps at Microsoft) have figured out yet.  Unfortunately, this is also happening during one of those high-profile, world leader conference type events that we have every so often, so it's a bit of an issue.  I pulled over 56 hours last week. :(  Hopefully this week will be a bit better.  I'm a bit burned out right now, which is why I'm blogging at the office instead of doing something useful.  Ok, I'm really waiting on the queues to drop so I can start messing with stuff again.

My Florida motorcycle trip is off.  I'm still not in good enough shape to enjoy it.  I'm going to go beat on the doctors a bit more and see what else we can do.

I might be posting up a few photos tonight from a recent ride out to Skyline Drive. Depends mostly on whether or not I can be bothered to pull them off the camera.

I still need new tires for the Jeep.  The JeepWobble™ is getting worse.  Might do that tonight.

I ordered a Sandisk Sansa Express MP3 player.  It was dirt cheap and I needed something a little more "durable" than my Zune.  The Zune is good and all, but I get a bit nervous taking a 30 Gb hard drive on Jeep trails.   The Express is small, recharges off the USB port, is built like a thumbdrive (so I won't need to carry around a cable), has 1GB of flash memory and can take microSD cards to expand it.  Did I mention that it was dirt cheap? ;)  You can check out a full review over on Anything But Ipod - excellent site!

I'm getting very sleepy.

L8rs!

Wednesday, October 10, 2007 9:26 AM

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , , ,

blog

I see the light (well, almost)

by smthng 9. October 2007 10:45

I got a voicemail this morning from Amondotech with a real tracking number for my package.  Looks like my lights really are on the way and should be here soon.  I wasn't planning on posting "blow-by-blow" accounts of this, but I figure it's only fair to at least let everyone (ok, both of you) know that the issue may well be resolved.  Laters!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

blog

Amondotech.com customer service (or lack of)

by smthng 9. October 2007 10:42

Anyone who's checked out my blog  for more than a few minutes knows that I rarely do this kind of thing, but sometimes a special case comes along that just defies all sense.  This is one of them... 

There's an online vendor called Amondotech that sells lights and batteries.  I'm a bit of a geek and have a weakness for stuff like that, so I generally dig through their emails every so often and occasionally snag something nifty.  Well, I'm probably deep in the process of getting burned by them.  If you're really bored you can check out my page about Amondotech's horrible customer service. It's possible this is all a big misunderstanding and an excellent demonstration of inability to do a simple task (like "ship a box"), but I really think we're well beyond that.

Mostly I'm just putting this here for the Googlebot to find (Editor's note: Hi bot!) in case anyone in the future feels like doing any research on them before being snarfed out of $200.  The process is still ongoing and I'm protected by my pretty reliable credit card bank, so I'm not worried about it, which means I don't need a flood of comments or emails spouting "poor you", thanks anyway!  I just figured others might need to know about it.  That's probably a page I'll update as the saga unfolds, but don't expect very many updates here on the blog... don't want to waste anyone's time with my inane drivel.  Well, at least not any more than I usually do. ;)

Laters!

All your money are belong to us!

Tuesday, October 09, 2007 1:42 PM

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

blog

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About smthng

Just a guy who digs Jeeps, photography, podcasts, sci-fi, running, motorcycles, and stuff.

Tags