Vista: Net Send is Gone; Use msg console Instead.

Filed under: Tech Stuff — Written by Chrissy on Wednesday, May 23rd, 2007 @ 3:59 pm

Today, I needed to net send a message to myself, but soon realized that it disappeared and is no longer supported in Vista. Then I found a a post on MSDN tipped me off to use msg instead. Msg is usually used for sending messages to terminal services users but, remembering that the console session has an ID of 1, I decided to try sending a message to the console user. As it turns out, msg 1 test worked both locally and remotely in Vista.

Then, I tried running the command on an XP machine, only to realize that XP's terminal services console ID was 0 and not 1. In order to msg the console in XP, I had to run msg 0 test. So what is session 0 in Vista? Well, according to the query session command, "services" use the ID of 0 in terminal services. Whoops. It appears that the best way for this to work across XP and Vista machines would be to use "msg console test" or "msg * test" or "msg username test". If you'd like to message remote machines, you can do so by pointing to a file that contains the names of multiple machines or by using the /SERVER switch ie. msg /SERVER:computername console "Message goes here".

If you need additional options or help, check out the TechNet article for more information.

Update: For those of you receiving the error message "error 5 getting session names", this appears to be a permissions error. Unlike "net send," you must be on the same Windows domain to send msgs to other computers. This is a good thing -- it means that msg is not prone to being abused by spammers.

Scheduling Tasks from a Command Line in Windows Vista and XP

Filed under: Tech Stuff — Written by Chrissy on Wednesday, May 23rd, 2007 @ 3:35 pm

I'd like to start this post with a warning: I'm only 29 years old but already have permanent damage to my shoulder caused by overusage while working/playing on the computer. Two years ago, I had to claim workman's comp because I was disabled for a few weeks, barely being able to even stand because of an excruciating pain in my shoulder - even gravity put too much pressure on it. I didn't know what was happening at first, I thought it just needed to "pop" but as it turned out, I had tendonitis/bursitis from repetitive mouse/keyboard usage. While the damage was permanent, the pain went away after a terribly painful cortisone shot was injected right into my shoulder. By that time, calcium had built up and I heard the needle crush right through it. Ugh, even with lots of Vicodin and some other topical pain killer, it was still unbelievably painful.

To stop the problem from recurring, I had my desk evaluated by an ergonomic specialist and ended up buying a new chair and a new keyboard tray. I also moved my mouse in closer to my body so that I wouldn't have to reach so far out. I got tips on how to sit, stretch, mouse, etc. I suggest that if you haven't had an ergo eval recently, ask your company to schedule one with a professional. The time I've invested at physical therapy, at the doctor's office, icing my shoulder, figuring out how to clean/cook with a bum shoulder, buying new backpacks, etc could have been avoided if I got into a healthy posture habit when I first started working on computers. So now.. I ice, take lots of ibuprofin and perform stretches.

Everyone, not just fools like me with bum shoulders, should stretch at least once an hour while on their computer. I'm pretty forgetful but even if I wasn't, I don't think its possible to remember to stretch every hour on the hour without some help. And this is where the command line task scheduling fun comes in.

Often times, I've scheduled tasks in both Windows and Unix from the command line using at. Today while researching creating a stretch task, I learned that Microsoft replaced at with schtasks and Apple replaced at with launchd. Works for me, Windows' at doesn't really support hourly tasks while schtasks does. Below is a scheduled task that I'm running in order to prevent further injury to my shoulder:

schtasks /create /tn StretchReminder /tr "msg console Stretch!" /sc HOURLY

Using this command, I've created a task to run once an hour which sends me a simple message that reads "Stretch!" You may wonder why I'm not using net send. The reason is that net send is no longer supported in Vista and msg is supported in both XP and Vista.

Here's hoping my shoulder gets better and yours never starts acting up.

Whispers from the Valley

Filed under: Tech Stuff — Written by Chrissy on Monday, May 14th, 2007 @ 3:52 pm

Haha worst post title ever.. so very Wal-Mart romance novel-esque. I love it.

So I wanted to share the word on the streets here in San Francisco. In attending conferences or hacker parties, here's the stuff that keeps cropping up, filtered to my tastes.

The dotcom is coming back
I often ask cab drivers about the original dotcom boom in SF. They often respond with stories about rude cell phone users or how impossible it was to get dinner reservation/place to rent. Recently, though, a 50 year old cab driver said "They're back. Just head down to South of Market. You'll see them everywhere." I noticed it but I was surprised that it was so obvious that he'd notice. Perhaps its the optimist in me but I don't think this will be a bubble/bust. Investors are smarter this time around.

Jeff Atwood (codinghorror.com) asked "What will you do differently this time?" I plan to spend an entire post on that. I'm eight years older this time around and now I live in the middle of all the action. There's a lot I'll do differently this time.

Amazon S3
All the startups, including smugmug are using Amazon's Simple Storage Service. We at RealCajunRecipes.com will be using it too, as a very affordable Content Delivery Network. Some people say it's not a CDN; I say whatever, it's cool that our visitors on the East Coast and the South will get their RCR images delivered from a much closer location. For just $0.10/Gig up and $0.18/Gig down (starting in June), it's likely that I'll also start using S3 and JungleDisk as a backup server as well. Even though there are cheaper solutions, I don't need to backup off-site but once a month so it works well for me.

Twitter.com
"Twitter is to blogging what chat is to e-mail." I overheard that at SHDH but can't find the source. I use Twitter sporadically; I can't really find a value for me yet.

BarCamp
BarCamp (or "BahCamp" in Boston) is "an ad-hoc gathering born from the desire for people to share and learn in an open environment. It is an intense event with discussions, demos, and interaction from participants. The name BarCamp was inspired as a complement to FooCamp." One of them in San Francisco is being held at Microsoft's offices. Drool (One day, my pretty).

Windows Powershell
Windows admins and enthusiasts are raising the roof about Powershell. It was one of the most talked about technologies at the recent Longhorn Roadshow that I attended. FYI, my friend Lee Holmes, a member of the PowerShell Team in Redmond, asked readers of his blog if any PowerShell newbies are interested in being technical reviewers for his O'reilly book "PowerShell: The Definitive Guide." I know I am! I've been anxiously awaiting my copy since May of last year.

Virtualization
This is one of my favorites, I'm totally in awe of virtualization technology, especially the stuff I see VMware put out. Longhorn has virtualization built in (a native SSL VPN too omg!) but many believe it will be about 2010 before they are a real competitor to VMware.

I could probably go on a bit more but I have finals to study for (again). Wish me luck.. I'll need it this class. Stuped [sic] hardware.

VBScript: Forward SQL Server Alerts/Windows Events to (Cingular) SMS

Filed under: SQL Server, VBScript — Written by Chrissy on Friday, May 11th, 2007 @ 6:11 pm

Someone recently asked why I don't use SQL Mail on my SQL Servers (2000 and below). The answer is: I don't want to install Outlook on my SQL Servers. Sure, there are ways around it but I prefer just using "net send" to alert the Operator (moi) then forwarding those messages on to my inbox and phone.

Although my employer offered me a Blackberry, I never really cared for them. The battery life is just too short and I don't like talking into something the size of my hand. So.. I use a regular phone that doesn't receive e-mails easily. It does, however, love to receive texts. Cingular even gave me an email address to go with my phone and this is what I use to Alert me if any of my jobs (Backups, Optimizations, etc) fail.

First, I created a DNS CNAME record to my workstation called DBAWorkstation. Then I created an operator named DBA Workstation. I like to keep things generic in the event that I leave or my workstation name changes. In the event that happens, there's just one change at the DNS level. So next, I set the jobs to alert this operator via net send if any jobs fail. Finally, I set up a script that runs all the time on my workstation which has IIS's SMTP installed locally:

'****************************************************************************
' This script created by Chrissy LeMaire (clemaire@gmail.com)
' Website: http://netnerds.net/
'
' NO WARRANTIES, etc.
'
' This script monitors Windows Events and forwards any Application Popups
' to an email address
'*****************************************************************************
 
' Push Event Viewer Alert
    Set objWMIService = GetObject("winmgmts:{(security)}!root/cimv2")
    Set eventSink = wscript.CreateObject("WbemScripting.SWbemSink", "EVSINK_")
    strWQL = "Select * from __InstanceCreationEvent where TargetInstance isa  'Win32_NTLogEvent' and TargetInstance.SourceName = 'Application Popup' and TargetInstance.EventCode = 26"
    objWMIService.ExecNotificationQueryAsync eventSink,strWQL
 
' Keep it going forever
While (True)
    Wscript.Sleep(1000)
Wend
 
Sub EVSINK_OnObjectReady(objObject, objAsyncContext)
'Here's where I do a whole lot of cleaning. Edit to your liking.
   strCleanedMsg = replace(objObject.TargetInstance.Message,"Application popup: Messenger Service  : ","")
   strCleanedMsg = replace(strCleanedMsg,"Message from ","")
   strCleanedMsg = replace(strCleanedMsg," to " & objObject.TargetInstance.ComputerName,"")
   strCleanedMsg = replace(strCleanedMsg," for DB Maintenance Plan 'DB Maintenance for All DBs'","")
   strCleanedMsg = replace(strCleanedMsg,"JOB RUN:","")
   strCleanedMsg = replace(strCleanedMsg," was run on "," failed around ")
   strCleanedMsg = Left(strCleanedMsg,InStr(strCleanedMsg,"DURATI")-2)
   If Len(strCleanedMsg) > 159 Then strCleanedMsg = Left(strCleanedMsg,159) ' SMS allows max 160 characters. I picked 159 just in case.
 
    Set objCDO = CreateObject("CDO.Message")
    objCDO.From = "SQL Alert <me@myemployer.com>"
    objCDO.To = "0000000000@cingularme.com" ' Phone number goes there. Cingular does the SMS magic
    objCDO.CC = "me@myemployer.com"
    objCDO.TextBody = strCleanedMsg
    objCDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 'cdoSendUsingPort (1 = local, 2= remote, 3 = Exchange)
    objCDO.Configuration.Fields.Update
    objCDO.Send
    set objCDO = Nothing
End Sub

Run that script as a service and you're set with SMS/E-mail notifications in SQL Server 2000 and below. SQL Server 2005 can do the same thing..but e-mail is much more accessible within the service itself.

Microsoft Office Sharepoint Server 2007 Quickstart

Filed under: SharePoint — Written by Chrissy on Friday, May 11th, 2007 @ 5:46 pm

Implementing and eventually developing Sharepoint 2007 (also known as MOSS) stuff is my next big project at 'work work'. It's been tough finding straightforward information on implementation but I finally did. First, Martin Kearn, an MCS Sharepoint guy based in the UK, wrote an outstanding four page guide (bulleted) titled "How to Install Sharepoint Server 2007 on a Single Machine." I adapted this slightly to use a small farm configuration. The only change I'd suggest for this guide is to use CNAME records in DNS instead of A records; it's a little less maintenance.

I also have a Sharepoint consultant friend, Trevor that shared a few tips. Here's what I've learned.

1. Microsoft SharePoint: Building Office 2007 Solutions in VB 2005 (or C# edition) is the holy grail of Sharepoint 2007 books. Not only does the author Scot Hillier, a well-known Sharepoint Expert, discuss development, but much of the book discusses administration as well. He also talks about implementation for the first three chapters or so. In this book I learned that...
2. Kerberos isn't just more secure than NTLM, but it also performs a lot better. More secure was intriguing but better performance had me sold.
3. Wondering what to name your Sharepoint website? Many companies name their Sharepoint sites: portal, extranet/intranet or sharepoint.
4. A small farm configuration (2 machines - SQL & App/IIS) with powerful servers is good enough for companies with 500 employees or less. At least to start..
5. Yes, many companies often run other small intranet sites on their Sharepoint IIS servers. I plan to as well.
6. Sharepoint 2007 is much more Internet friendly than Sharepoint 2003. Many companies are now using Sharepoint to power their Internet websites.
7. Fir those running MOSS 2007 in a lab environment, don't run it on a domain controller; it's been said not to work.

Also, here's a list of my bookmarks tagged as sharepoint setup on delicious.

WSUS 3.0 Now Available for Download

Filed under: Tech Stuff — Written by Chrissy on Tuesday, May 1st, 2007 @ 12:02 pm

Microsoft Windows Server Update Services 3.0 is now available for download.

I updated 4 of my servers from WSUS 2.0 to 3.0 today with no apparent problems - the install was very smooth. The biggest difference so far is the move from WSUS Administration being web-based to being an MMC 3.0 snap-in.

If you'd like to administer your WSUS 3.0 install from a workstation, just double click WSUS3Setupx86.exe and select Administration Console Only when prompted. Once installed, the snap-in can be found under Administrative Tools -> Microsoft Windows Server Update Services 3.0. I thought of just yanking the wsus.msc module itself but it seems the Console_install switch installs not only that file but also 230+ of its friends. According to the Microsoft employee who left a comment below, you must install the entire package for the msc to work.

TechNet also added a section for Server-Side management on Windows Update Server. The current scripts include:
- Delete Empty Target Groups
- Re-index the WSUS 3.0 Database
- Server Status for Approved Updates
- Server Status Summary for All Computers and Updates
- Start Server Synchronization

WSUS 3.0 also allows administration from the command line using both wsutil and Powershell via the WSUS 3.0 API.

5 Ways To Stop Windows Vista/XP/2003 From Beeping

Filed under: Tech Stuff — Written by Chrissy on Tuesday, May 1st, 2007 @ 9:24 am

This came up twice in the past week at work so I decided to post it. Here's a few ways to disable the annoying beep in Windows. Works especially well to hush Terminal Services Beeping. I ran this on the clients but it may work for the server as well.

1. local machine: sc stop beep && sc config beep start= disabled
2. remote machine: sc \remoteMachine stop beep && sc \remoteMachine config beep start= disabled
3. requires reboot: Device Manager -> View -> Show Hidden Devices -> Non Plug and Play -> Beep -> Disable
4. requires reboot: net stop beep
5. use TweakUI: General > Settings -> Uncheck the Beep on Errors

Sources: tech-recipes, sonhaysytem.com and JSI FAQ.