Wednesday, March 28, 2007

Soccer Dad

I'm officially a soccer dad. Took Chloe to her first practice. I was the one dad among a dozen moms. Evelyn took Evan to his practice and had the opposite experience. We'll probably trade off kids each practice. Chloe got a very good coach (Kristin). She was great with all the kids. Chloe did great learning her first soccer skills.

Tuesday, March 27, 2007

Eating In

We ate out today because Rick started with us and you always have to take the new guy to lunch right? But generally I and most of the guys on the team are pretty good about eating in. I'm the most fanatical about it having foregone lunch out a few times now. I'm trying to limit my lunches out to just Friday. This makes lunch out an enjoyable treat instead of a daily chore. I'm very gradually losing weight because of eating healthier lunches and getting exercise every day. I've lost just about 8 lbs now. I find my weight fluctuates by as much as 4 lbs on a given day. Water weight I guess. Bouncing around 280 - 284 these days. I was a solid 290 when I started my new job.

Walking

About the time I started meditating every day I started walking every day. Twice a day if I'm lucky. I've made it part of my daily routine to take a solid 15 minute break in the morning and again in the afternoon. At this time I just head out the door and walk briskly around the office park. It's just exactly a one mile loop. This is good exercise both physically and mentally. It's so nice to take breaks during the day. Something I've never done before in my career. All part of the work-life balance thing. I try to avoid stressful 50 hour work weeks and spend more time doing things that are healthy for me.

When I die, my inbox will NOT be empty. Might as well enjoy life now.

One problem. It's getting hot. I'm not sure how I'm going to pull this lifestyle change off in the heat of NC summer.

Meditation

One of the key theme's in Spider Robinson/Robert Heinlein's book, Variable Star, is on meditation. I've done some research on the topic and have been practicing sitting meditation just about every day for about 6 weeks now. It's definitely good stuff. I don't fully understand how it all works just yet, but I enjoy it and feel generally happier and healthier on days when I do it. I've ordered up a meditation DVD from Netflix so I hope to learn more about the topic. Right now I'm just sitting zazen for 15 - 20 minutes each morning and performing a controlled breathing exercise. I concentrate very hard on thinking about nothing. This is very difficult. Hard to achieve but I do seem to have these moments of clarity when I am in a "nothingness trance". All the world's problems seem to melt away when I hit this state.

Help Arrives

Rick joined us today at work. Now I have some help. Just in time. My boss has been on extended leave of abscence to take care of family matters. This in the middle of a complex mail migration. Work has been a bit stressful. But now Rick is here. First impressions are mostly positive. He's very smart and a capable Windows admin. He seems very easy to work with so far. He's a CompSci grad. And to top it off he's an avid hiker. He mentioned there's a local MeetUp group for hikers and he's going to get me hooked up. That's cool. Only downside so far -- he's a smoker. Go figure.

Monday, March 26, 2007

Move Files Script

There's a method called .MoveFile, but you can't pass it the True on the end which means Overwrite if already exists. Why I have no idea. So this logic copies the file and then does a delete.

Note the slash at the end of the copy command. This is needed to let it know to put it into a folder. Otherwise it tries to create it as a file.

Also includes logic for creating the destination folder.


sSource = "c:\test\myfile.txt"
sDestination = "d:\folder1"
set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(sDestination) Then
Set oFolder = oFSO.CreateFolder(sDestination)
End If
set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(sSource) Then
oFSO.CopyFile sSource, sDestination & "\", True
oFSO.DeleteFile sSource
End If

Group Membership Script

Reveals the members of a group.

Dim objArguments, strDomainGrp
Set objArguments = Wscript.Arguments
If WScript.Arguments.Count = 0 then Wscript.Quit
strDomainGrp=objArguments(0)
On Error Resume Next
Set objGroup = GetObject("LDAP://cn=" & strDomainGrp & ",ou=distribution lists,dc=company,dc=com")
objGroup.GetInfo
arrMemberOf = objGroup.GetEx("member")
For Each strMember in arrMemberOf
WScript.echo """" & strDomainGrp & """;""" & strMember & """"
Next

Clear Attribute Script

Clears an attribute (here targetAddress) from each account listed in input.txt.

Const ADS_PROPERTY_CLEAR = 1
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1 'Distinguished Name
Set oRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = oRootDSE.Get("defaultNamingContext")
Set oTrans = CreateObject("NameTranslate")
oTrans.Init ADS_NAME_INITTYPE_GC, sDNSDomain
oTrans.Set ADS_NAME_TYPE_1779, sDNSDomain
sNetBIOSDomain = oTrans.Get(ADS_NAME_TYPE_NT4)
sNetBIOSDomain=Left(sNetBIOSDomain,Len(sNetBIOSDomain)-1)
sFile = "input.txt"
set oFSO = CreateObject("Scripting.FileSystemObject")
set oTextFile = oFSO.OpenTextFile (sFile)
Do
sUser = oTextFile.ReadLine
oTrans.Init ADS_NAME_TYPE_1779, sNetBIOSDomain
oTrans.Set ADS_NAME_TYPE_NT4, sNetBIOSDomain & "\" & sUser
sUserDN = oTrans.Get(ADS_NAME_TYPE_1779)
set oUser = GetObject ("LDAP://" & sUserDN)
oUser.PutEx ADS_PROPERTY_CLEAR, "targetAddress", 0
oUser.SetInfo
Loop Until oTextFile.AtEndOfLine = true
wscript.Echo "All Done"

Add Email Addresses Script

Adds an email address to accounts listed in input.txt

Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1 'Distinguished Name
Set oRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = oRootDSE.Get("defaultNamingContext")
Set oTrans = CreateObject("NameTranslate")
oTrans.Init ADS_NAME_INITTYPE_GC, sDNSDomain
oTrans.Set ADS_NAME_TYPE_1779, sDNSDomain
sNetBIOSDomain = oTrans.Get(ADS_NAME_TYPE_NT4)
sNetBIOSDomain=Left(sNetBIOSDomain,Len(sNetBIOSDomain)-1)
sFile = "input.txt"
set oFSO = CreateObject("Scripting.FileSystemObject")
set oTextFile = oFSO.OpenTextFile (sFile)
Do
sUser = oTextFile.ReadLine
oTrans.Init ADS_NAME_TYPE_1779, sNetBIOSDomain
oTrans.Set ADS_NAME_TYPE_NT4, sNetBIOSDomain & "\" & sUser
sUserDN = oTrans.Get(ADS_NAME_TYPE_1779)
set oUser = GetObject ("LDAP://" & sUserDN)
sAddress = "smtp:" & oUser.givenName & "." & oUser.SN & "@tgt1.company.com"
bIsFound = False
vProxyAddresses = oUser.ProxyAddresses
nProxyAddresses = UBound(vProxyAddresses)
i = 0
Do While i <= nProxyAddresses
If vProxyAddresses(i) = sAddress Then
bIsFound = True
'wscript.echo "address already exists for " & sUser
Exit Do
End If
i = i + 1
Loop
If Not bIsFound Then
wscript.echo "Adding " & sAddress
ReDim Preserve vProxyAddresses(nProxyAddresses + 1)
vProxyAddresses(nProxyAddresses + 1) = sAddress
oUser.ProxyAddresses = vProxyAddresses
oUser.SetInfo

End If
Loop Until oTextFile.AtEndOfLine = true
wscript.Echo "All Done"

Delete Mailboxes Script

Deletes the mailboxes associated with accounts in input.txt

Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
Set oRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = oRootDSE.Get("defaultNamingContext")
Set oTrans = CreateObject("NameTranslate")
oTrans.Init ADS_NAME_INITTYPE_GC, sDNSDomain
oTrans.Set ADS_NAME_TYPE_1779, sDNSDomain
sNetBIOSDomain = oTrans.Get(ADS_NAME_TYPE_NT4)
sNetBIOSDomain=Left(sNetBIOSDomain,Len(sNetBIOSDomain)-1)
sFile = "input.txt"
set oFSO = CreateObject("Scripting.FileSystemObject")
set oInputFile = oFSO.OpenTextFile (sFile)
Do
sUser = oInputFile.ReadLine
oTrans.Init ADS_NAME_TYPE_1779, sNetBIOSDomain
oTrans.Set ADS_NAME_TYPE_NT4, sNetBIOSDomain & "\" & sUser
sUserDN = oTrans.Get(ADS_NAME_TYPE_1779)
set oUser = GetObject ("LDAP://" & sUserDN)
oUser.DeleteMailbox
oUser.SetInfo
Loop Until oInputFile.AtEndOfLine = true
wscript.Echo "All Done"

Move Mailboxes Script

Moves all the mailboxes listed in input.txt to a particular store.

Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
sInFile = "input.txt"
Set oRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = oRootDSE.Get("defaultNamingContext")
Set oTrans = CreateObject("NameTranslate")
oTrans.Init ADS_NAME_INITTYPE_GC, sDNSDomain
oTrans.Set ADS_NAME_TYPE_1779, sDNSDomain
sNetBIOSDomain = oTrans.Get(ADS_NAME_TYPE_NT4)
sNetBIOSDomain=Left(sNetBIOSDomain,Len(sNetBIOSDomain)-1)
set oFSO = CreateObject("Scripting.FileSystemObject")
set oInputFile = oFSO.OpenTextFile (sInFile)
Do
sUser = oInputFile.ReadLine
oTrans.Init ADS_NAME_TYPE_1779, sNetBIOSDomain
oTrans.Set ADS_NAME_TYPE_NT4, sNetBIOSDomain & "\" & sUser
sUserDN = oTrans.Get(ADS_NAME_TYPE_1779)
set oUser = GetObject ("LDAP://" & sUserDN)
sExchangeServer = oUser.msExchHomeServerName
i = 1
Do
sRightPiece = Right(sExchangeServer, i)
If Left(sRightPiece, 1) = "=" Then
sExchangeServer = Right(sExchangeServer, i - 1)
Exit Do
End If
i = i + 1
Loop
sTargetMDB = "CN=Mailboxes,CN=Fourth Storage Group,CN=InformationStore,CN=" & sExchangeServer & ",CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=RHD,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=company,DC=com"
oUser.MoveMailbox sTargetMDB
oUser.SetInfo
Loop Until oInputFile.AtEndOfLine = true
wscript.Echo "All Done"

Bulk Exmerge

Getting tired of writing scripts at one company, leaving, and having to reinvent the wheel, so I'll store some scripts here. Of course, next year we'll probably be on Exchange 2007 and all this work will be moot (see "Monad"), but just in case. And who knows, maybe somebody else will benefit from this someday, though these are well documented elsewhere (that's how I figured them out after all -- thanks google.)

This script takes an input.txt file full of samAccountNames and creates a Mailboxes.txt file ready for Exmerge to operate on in Bulk mode. Need to then call Exmerge /B /D. The exmerge.ini file needs to be setup with input servername, default destination folder, etc.

Exmerge needs the ExchangeLegacyDN in order to locate the mailbox. This code has good generic code that can be used to latch onto a user object. From there you can easily set any property on the account or extract info about the account.

Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
sInFile = "input.txt"
sOutFile = "mailboxes.txt"
Set oRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = oRootDSE.Get("defaultNamingContext")
Set oTrans = CreateObject("NameTranslate")
oTrans.Init ADS_NAME_INITTYPE_GC, sDNSDomain
oTrans.Set ADS_NAME_TYPE_1779, sDNSDomain
sNetBIOSDomain = oTrans.Get(ADS_NAME_TYPE_NT4)
sNetBIOSDomain=Left(sNetBIOSDomain,Len(sNetBIOSDomain)-1)
set oFSO = CreateObject("Scripting.FileSystemObject")
set oInTextFile = oFSO.OpenTextFile (sInFile)
set oFSO = CreateObject("Scripting.FileSystemObject")
set oOutTextFile = oFSO.CreateTextFile (sOutFile)
Do
sUser = oInTextFile.ReadLine
oTrans.Init ADS_NAME_TYPE_1779, sNetBIOSDomain
oTrans.Set ADS_NAME_TYPE_NT4, sNetBIOSDomain & "\" & sUser
sUserDN = oTrans.Get(ADS_NAME_TYPE_1779)
set oUser = GetObject ("LDAP://" & sUserDN)
sLegacyExchangeDN = oUser.LegacyExchangeDN
oOutTextFile.Writeline sLegacyExchangeDN
Loop Until oInTextFile.AtEndOfLine = true
wscript.Echo "All Done"

Triple Play

Why have only two garden beds when I can have three! I now have 3 beds with 150 sq ft of gardening heaven. Still need to fill #3 with dirt.

Bed 1 has a wide block of carrots sprouting now. Garlic is tall & green & seems generally happy.

Bed 2 has 4 tomato plants (24" spacing? really?), then two rows of cucumbers, 3 half rows (block style) of peas, 3 half-rows of spinach, 3 half-rows of lettuce. Everything is well watered and fertilized. Plan to extend the half rows in a few weeks to extend the harvest.

Bed 3 has at least beets & squash planned for a bit later in spring. Do I want to tackle melons? hmmm.

Tuesday, March 20, 2007

A new garden

The kids planted carrots throughout the remaining space in the garlic garden. I ordered bunch of seeds from Ed Hume's Seeds. Carrots (orange, red, purple, yellow, and white), cukes, peas, lettuce, spinach, herbs, sunflowers, and mixed flowers. I figure this is enough for my first attempt. I picked up some more cedar boards and knocked together Bed #2. So now I have 100 sqft of gardening space. Ordered 8 cuyds of very rich soil from The Mulch Masters. My neighbor just sort of spontaneously showed up with a wheelbarrow and started helping me move this mini-mountain of dirt. Eventually he pointed out that moving this up my driveway hill was way too much work and he brought over his pickup (which just happened to have a dirt unloader installed. So we filled up the pickup several times. We've moved about half the dirt. More fun tonight. I definitely owe this guy a six pack.

Research indicates the garlic will be ready for harvest anywhere between May and July, depending on the variety. So I'm still waiting to see the scapes go up and the leaves to turn brown; that's supposed to be the sign.

3500 mailboxes

Been so busy at work lately. I've been using Quest's Migration Manager to migrate 3500 Exchange mailboxes from a one company to another (part of an acquisition). That tool is very powerful and cool and wonderful except for the parts that are buggy and hard-to-understand. Steep learning curve, but we eventually got everything moved. Hopefully more time for blogging now.