4

We have a staff member in sales who has gone onto a 4 day week (getting ready for retirement), so each Thursday afternoon her email needs to be forwarded to another user and each Friday afternoon it needs to be set back.

I'm using the VBS script below to do this, run via the Task Scheduler. Although the script appears to do it's job, based on what I see when I view the user's Exchange settings, Exchange doesn't always recognise that the setting has changed. e.g. Last Thursday the forwarding was a enabled and worked correctly. On Friday the script did it's thing to clear the forwarding but Exchange continued to forward messages all weekend.

I found that I can force Exchange to honour the changed setting be merely opening and closing the user's properties in ADUC. Of course I don't want to have to do that. Is there a non-manual way I can have Exchange read and honour the setting?

The script (VBS):

' Call this script with the following parameters:
'
' SrcUser       - The logon ID of the suer who's account is to be modified
' DstUser       - The logon account of the person to who mail is to be forwarded
'                           Use "reset" to clear the email forwarding

SrcUser = WScript.Arguments.Item(0)
DstUser = WScript.Arguments.Item(1)

SourceUser = SearchDistinguishedName(SrcUser) 'The user login name
Set objUser = GetObject("LDAP://" & SourceUser)

If DstUser = "reset" then
objUser.PutEx 1, "altRecipient", ""
Else
ForwardTo = SearchDistinguishedName(DstUser)' The contact common name
objUser.Put "AltRecipient", ForwardTo
End If

objUser.SetInfo

Public Function SearchDistinguishedName(ByVal vSAN)
Dim oRootDSE, oConnection, oCommand, oRecordSet

    Set oRootDSE = GetObject("LDAP://rootDSE")
    Set oConnection = CreateObject("ADODB.Connection")
    oConnection.Open "Provider=ADsDSOObject;"
    Set oCommand = CreateObject("ADODB.Command")
    oCommand.ActiveConnection = oConnection
    oCommand.CommandText = "<LDAP://" & oRootDSE.get("defaultNamingContext") & ">;(&(objectCategory=User)(samAccountName=" & vSAN & "));distinguishedName;subtree"
    Set oRecordSet = oCommand.Execute
    On Error Resume Next
    SearchDistinguishedName = oRecordSet.Fields("DistinguishedName")
    On Error GoTo 0
    oConnection.Close
    Set oRecordSet = Nothing
    Set oCommand = Nothing
    Set oConnection = Nothing
    Set oRootDSE = Nothing
End Function

Edit:

If someone has another way to achieve the same goal (scheduled forwarding and cancellation of same) I'm open to suggestions. Surely this need has been encountered and met before.

Update:

For reasons I won't even try to guess, without changing anything the script system has been working almost completely reliable for some time. Over the last 3 or 4 months it has only failed once.

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108

2 Answers2

1

Wouldn't it be easier (and kinder) to simply setup a shared "Sales" mailbox, let all the required salesdroids use it. Its never going to be as fast as a simple redirection, but there is no need to script it or anything then. (We use many here, allows users to change roles, get promoted, quit etc without having to worry about redirecting or informing customers of new addresses etc).

The other alternative (in Exchange) is a Public Folder, simply create & set permissions on it for all who will need access (using Outlook), then assign the email address[es] you require (in System Manager, will default to "Foldername@domainname.com"), then all mail will go there instead.. has similar/familiar delegation controls/permissions etc. If particular users need access to shared calendars or mailboxes, they can set them as "Favorites".

That way, users can "Grab" messages for themselves, by moving them into their own mailbox, or deleting them when done etc.. Also, looks professional when you see: Joe Bloggs on Behalf of Sales@company.com. If its the public folder, turn of "Maintain Per user Read/unread information.." then staff can tell when a message has already been read by someone else.

Customers like it, they get an easy to remember address and, their messages aren't lost! (that is the biggie I think)

The managers like it, they can keep tabs on open items, weigh in on things and generally be "Managers".. ;-)

Grizly
  • 2,053
  • 15
  • 20
  • While those are perfectly good ideas, for which I thank you, they unfortunately don't take into account the human factor. The main user in this instance is one so set in her ways that I cannot even update her Outlook from XP to 2003. Although she will retire soon she is far too valuable to the company and we must pander to her quirks. At least until such time as we can find someone to fill the position she will be vacating sometime within the next year or so. She really is exceptionally good at her job (probably because she's been doing it for the last 150 years). – John Gardeniers May 27 '10 at 03:23
  • Geez.. then run a rule on her outlook that any unread messages received to that shared box, be copied to her inbox.. might work, as it would only run while outlook was open.. so assuming she shuts-down at the end of a day.. – Grizly Jun 03 '10 at 00:26
0

I think you may find that a less technical solution meets your needs.

Give permission to access the 4 day weekers mailbox to the person you would have forwarded their mail to.

You can set up the user account to send replies in their own name, on behalf of, or sent as the 4 day weeker.

Sure, you still have to make sure that the other member of staff checks the mailbox, which may be an issue if this is sales related.

Or you could just use Out of Office to forward the mail on to the appropriate member of staff. Your 4 dayer could then just switch on Out of Office every Thursday. She'll get prompted to switch it off when she logs back in. Once Out of Office is configured, it will have the same config each time she opens Outlook.

Again, it requires someone to take a manual action - but if she is that good, switching on Out of Office every Thursday before she leaves isn't that hard to remember (and you could set a Task with a reminder in Outlook for 4:30pm every Thursday).

It might also be easier to script switching on Out of Office, with whatever rules have already been configured for the user.

dunxd
  • 9,482
  • 21
  • 80
  • 117
  • I am of course aware that there are workarounds but for a variety of reasons we prefer not to use any of those. An automated system is always preferable to a manual operation. – John Gardeniers May 27 '10 at 23:16