phirebird

Configure Outlook Exchange email account through login script

This one’s a common issue – you’ve got hundreds of users and want an efficient way of handing out Exchange email account settings to all of your Outlook users. Well, I’m going to cut through all the waffle and tell you the method I use.

I create a .prf file (Outlook Profile), store it in a shared server location, and reference it from within a login script. The problem is, I only want it to run once (when a user logs into a machine for the first time). So I check for the existence of a junk file in the users profile directory (C:\Doc & Set\user\outlookdone.dat – which incidentally also contains the date it was originally done). The resulting login batch file looks a bit like this:

if exist “%USERPROFILE%\outlookdone.dat” goto outlookdone
echo Configuring Outlook EMail profile..
“c:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE” /importprf \\server\share\outlook.prf
echo %date% >”%USERPROFILE%\outlookdone.dat”

: outlookdone

(NB: that this is for Outlook 2003 – OFFICE11. This method should also work for 2002 and 2007 – however it has not been tested). Finally, the all important .prf file looks a bit like this:

[General]
Custom=1
ProfileName=Default profile
DefaultProfile=Yes
OverwriteProfile=No
ModifyDefaultProfileIfPresent=FALSE

[Service List]
;ServiceX=Microsoft Outlook Client
ServiceEGS=Exchange Global Section
Service1=Microsoft Exchange Server
ServiceEGS=Exchange Global Section

[ServiceEGS]
MailboxName=%UserName%
HomeServer=YOUREXCHANGESERVERNAMEGOESHERE
[Service1]
OverwriteExistingService=No
UniqueService=Yes
MailboxName=%UserName%
HomeServer=YOUREXCHANGESERVERNAMEGOESHERE
AccountName=Microsoft Exchange Server

[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517
MailboxName=PT_STRING8,0×6607
HomeServer=PT_STRING8,0×6608
OfflineAddressBookPath=PT_STRING8,0x660E
OfflineFolderPath=PT_STRING8,0×6610

[Exchange Global Section]
SectionGUID=13dbb0c8aa05101a9bb000aa002fc45a
MailboxName=PT_STRING8,0×6607
HomeServer=PT_STRING8,0×6608
RPCoverHTTPflags=PT_LONG,0×6623
RPCProxyServer=PT_UNICODE,0×6622
RPCProxyPrincipalName=PT_UNICODE,0×6625
RPCProxyAuthScheme=PT_LONG,0×6627
CachedExchangeConfigFlags=PT_LONG,0×6629

[Microsoft Mail]
ServiceName=MSFS
ServerPath=PT_STRING8,0×6600
Mailbox=PT_STRING8,0×6601
Password=PT_STRING8,0x67f0
RememberPassword=PT_BOOLEAN,0×6606
ConnectionType=PT_LONG,0×6603
UseSessionLog=PT_BOOLEAN,0×6604
SessionLogPath=PT_STRING8,0×6605
EnableUpload=PT_BOOLEAN,0×6620
EnableDownload=PT_BOOLEAN,0×6621
UploadMask=PT_LONG,0×6622
NetBiosNotification=PT_BOOLEAN,0×6623
NewMailPollInterval=PT_STRING8,0×6624
DisplayGalOnly=PT_BOOLEAN,0×6625
UseHeadersOnLAN=PT_BOOLEAN,0×6630
UseLocalAdressBookOnLAN=PT_BOOLEAN,0×6631
UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0×6632
UseHeadersOnRAS=PT_BOOLEAN,0×6640
UseLocalAdressBookOnRAS=PT_BOOLEAN,0×6641
UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0×6639
ConnectOnStartup=PT_BOOLEAN,0×6642
DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0×6643
DisconnectAfterRetrieveMail=PT_BOOLEAN,0×6644
DisconnectOnExit=PT_BOOLEAN,0×6645
DefaultDialupConnectionName=PT_STRING8,0×6646
DialupRetryCount=PT_STRING8,0×6648
DialupRetryDelay=PT_STRING8,0×6649

[Personal Folders]
ServiceName=MSPST MS
Name=PT_STRING8,0×3001
PathToPersonalFolders=PT_STRING8,0×6700
RememberPassword=PT_BOOLEAN,0×6701
EncryptionType=PT_LONG,0×6702
Password=PT_STRING8,0×6703

[Unicode Personal Folders]
ServiceName=MSUPST MS
Name=PT_UNICODE,0×3001
PathToPersonalFolders=PT_STRING8,0×6700
RememberPassword=PT_BOOLEAN,0×6701
EncryptionType=PT_LONG,0×6702
Password=PT_STRING8,0×6703

[Outlook Address Book]
ServiceName=CONTAB

[LDAP Directory]
ServiceName=EMABLT
ServerName=PT_STRING8,0×6600
UserName=PT_STRING8,0×6602
UseSSL=PT_BOOLEAN,0×6613
UseSPA=PT_BOOLEAN,0×6615
DisableVLV=PT_LONG,0×6616
DisplayName=PT_STRING8,0×3001
ConnectionPort=PT_STRING8,0×6601
SearchTimeout=PT_STRING8,0×6607
MaxEntriesReturned=PT_STRING8,0×6608
SearchBase=PT_STRING8,0×6603

[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046
FormDirectoryPage=PT_STRING8,0×0270
WebServicesLocation=PT_STRING8,0×0271
ComposeWithWebServices=PT_BOOLEAN,0×0272
PromptWhenUsingWebServices=PT_BOOLEAN,0×0273
OpenWithWebServices=PT_BOOLEAN,0×0274
CachedExchangeMode=PT_LONG,0x041f
CachedExchangeSlowDetect=PT_BOOLEAN,0×0420

[Personal Address Book]
ServiceName=MSPST AB
NameOfPAB=PT_STRING8,0x001e3001
Path=PT_STRING8,0x001e6600
ShowNamesBy=PT_LONG,0×00036601

; ************************************************************************
; Section 7 – Mapping for internet account properties.  DO NOT MODIFY.
; ************************************************************************

[I_Mail]
AccountType=POP3
;— POP3 Account Settings —
AccountName=PT_UNICODE,0×0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;— POP3 Account Settings —
POP3Server=PT_UNICODE,0×0100
POP3UserName=PT_UNICODE,0×0101
POP3UseSPA=PT_LONG,0×0108
Organization=PT_UNICODE,0×0107
ReplyEmailAddress=PT_UNICODE,0×0103
POP3Port=PT_LONG,0×0104
POP3UseSSL=PT_LONG,0×0105
; — SMTP Account Settings —
SMTPServer=PT_UNICODE,0×0200
SMTPUseAuth=PT_LONG,0×0203
SMTPAuthMethod=PT_LONG,0×0208
SMTPUserName=PT_UNICODE,0×0204
SMTPUseSPA=PT_LONG,0×0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0×0010
SMTPPort=PT_LONG,0×0201
SMTPUseSSL=PT_LONG,0×0202
ServerTimeOut=PT_LONG,0×0209
LeaveOnServer=PT_LONG,0×1000

[IMAP_I_Mail]
AccountType=IMAP
;— IMAP Account Settings —
AccountName=PT_UNICODE,0×0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;— IMAP Account Settings —
IMAPServer=PT_UNICODE,0×0100
IMAPUserName=PT_UNICODE,0×0101
IMAPUseSPA=PT_LONG,0×0108
Organization=PT_UNICODE,0×0107
ReplyEmailAddress=PT_UNICODE,0×0103
IMAPPort=PT_LONG,0×0104
IMAPUseSSL=PT_LONG,0×0105
; — SMTP Account Settings —
SMTPServer=PT_UNICODE,0×0200
SMTPUseAuth=PT_LONG,0×0203
SMTPAuthMethod=PT_LONG,0×0208
SMTPUserName=PT_UNICODE,0×0204
SMTPUseSPA=PT_LONG,0×0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0×0010
SMTPPort=PT_LONG,0×0201
SMTPUseSSL=PT_LONG,0×0202
ServerTimeOut=PT_LONG,0×0209
CheckNewImap=PT_LONG,0×1100
RootFolder=PT_UNICODE,0×1101

[INET_HTTP]
AccountType=HOTMAIL
Account=PT_UNICODE,0×0002
HttpServer=PT_UNICODE,0×0100
UserName=PT_UNICODE,0×0101
Organization=PT_UNICODE,0×0107
UseSPA=PT_LONG,0×0108
TimeOut=PT_LONG,0×0209
Reply=PT_UNICODE,0×0103
EmailAddress=PT_UNICODE,0x000C
FullName=PT_UNICODE,0x000B
Connection Type=PT_LONG,0x000F
ConnectOID=PT_UNICODE,0×0010

 

Did you find this hint useful? Are you looking to learn more? Well, here’s a few books that I’ve found useful – have a goosie!


Mastering Microsoft Exchange Server 2003
 
Microsoft Windows Shell Script Programming
 
Microsoft Windows Script Host
 
Active Directory for Dummies

 

 

Redirecting My Documents shell folder from a login script / commandline

I’ve always been a firm believer in Group Policy redirecting users’ My Documents folders for me – but there’s nothing like the reassurance of a good old batch file carrying this operation out for you.

So how do you do it? Well, the location of My Documents is stored in the registry (which is read by the explorer process when it’s spawned) and is located here:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal

As you would expect, editing this one value redirects My Docs. So, as part of your network login script, you can achive this automatically by adding in:

reg add “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders” /v Personal /t REG_EXPAND_SZ /d \\server\%USERNAME% /f

…to redirect to your server using the username of the currently logged on user as the share name.

 

Did you find this hint useful? Are you looking to learn more? Well, here’s a few books that I’ve found useful – have a goosie!


Active Directory for Dummies
 
Microsoft Windows Shell Script Programming
 
Microsoft Windows Script Host
 
Mastering Windows Server 2003

 

 

Can’t remove IP NAT entries on Cisco router: %Static entry in use, cannot remove

While removing IP NAT entries on a busy Cisco router – you’ll probably end up with this problem:

phbrtr(config)#no ip nat source static tcp 192.168.0.1 25 interface FastEthernet1/0 25
%Static entry in use, cannot remove

phbrtr(config)#

So what it is? Well, as the errors suggests, the rule is currently being used and as such can’t be changed (in this particular instance, there were a few active SMTP connections). On busy routers, this activity sometimes cannot be helped!

So how do you get around it? Well the first way is simply to wait for a lul in the traffic! When this isn’t possible, you can try clearing current IP NAT dynamic translations: (NB: Be quick!)

phbrtr(config)#no ip nat source static tcp 192.168.0.1 25 interface FastEthernet1/0 25
%Static entry in use, cannot remove

phbrtr(config)#do clear ip nat translation *
phbrtr(config)#no ip nat source static tcp 192.168.0.4 25 interface FastEthernet1/0 25
phbrtr(config)#

If this still doesn’t work (note that once you’ve issued the clear ip nat command – any new packets will create a new nat entry – hence ‘Be quick’!), you will to stop nat for a while to allow you to remove the translation:

phbrtr(config)#no ip nat source static tcp 192.168.0.1 25 interface FastEthernet1/0 25
%Static entry in use, cannot remove

phbrtr(config)#interface FastEthernet0/0
phbrtr(config-if)#no ip nat inside
phbrtr(config-if)#exit

phbrtr(config)#interface FastEthernet1/0
phbrtr(config-if)#no ip nat outside
phbrtr(config-if)#exit

phbrtr(config)#do clear ip nat translation *
phbrtr(config)#no ip nat source static tcp 192.168.0.1 25 interface FastEthernet1/0 25

phbrtr(config)#interface FastEthernet0
phbrtr(config-if)#ip nat inside
phbrtr(config-if)#exit

phbrtr(config)#interface FastEthernet1/0
phbrtr(config-if)#ip nat outside
phbrtr(config-if)#exit

 This demo removes IP NAT from both inside and outside interfaces – but you could try to removing it from just one (for ease) - but it will obviously depend on your setup.

Are you looking to learn more about Cisco equipment? Well, here’s a selection of a few books that I’ve found useful over the years:


Cisco: A Beginner’s Guide
 
CCNA – Cisco Certified Network Associate Study Guide
 
Cisco Networking for Dummies
 
Cisco IOS in a Nutshell – O’Reilly

 

Windows 2008 Server ADPREP detected that the domain is not in native mode

I’ve done a few 2000 / 2003 domain migrations now to 2008 server – but recently hit across one where (when issuing adprep /domain prep) I got the error:

Adprep detected that the domain is not in native mode

Rather irritatingly, it doesn’t say how to put it into native mode – but it is a very simple operation:

On a domain controller, fire up Active Directory Domains and Trusts. Right-click on your domain and select Raise Domain Functional Level. From the drop-down list box, select Windows 2000 Native and click Raise.

You’ll get a message indicating that the functional level was raised successfully. As you’ve probably already clicked ‘OK’ – it also mentioned that it may take some time to replicate the change to other domain controllers. If ADPREP still complains – then you know why! Go make yourself a coffee!

 

Did you find this hint useful? Are you looking to learn more? Well, here’s a few books that I’ve found useful – have a goosie!


Windows Server 2008 Administrator’s Companion
 
Windows Server 2008 for Dummies
 
Introducing Windows Server 2008
 
Designing, Deploying, and Running Active Directory

 

 

How to disable Windows 2003 Server Shutdown Event Tracker

A rather irritating feature in 2003 (and 2008) server is the shutdown event tracker. For those not familiar with this – it’s a dialog box that appears when you try to shutdown Windows and won’t let you proceed until you give it a reason why you’re shutting it down!

Entering flippant remarks loses it’s novelty value after a while, so here is a quick how-to on disabling this feature. It does involve editing some group policies – which will depend on wheter you want to apply this to the machine or the entire domain.

First, fire up group policy editor and make this change to an existing or a new policy (make sure you apply the policy when you’re done!). If you want to apply this to the local machine (or one that isn’t part of a domain) – you can just do start/run and enter gpedit.msc

From the left-hand pane, navigate to (Policy root) – Computer Configuration – Administration Templates – System. Then double-click ’Display Shutdown Event Tracker’ on the right-hand pane to display it’s properties. Set this to ‘Disabled’ and click OK.

You’re finished! Don’t forget, if you made the change to a domain policy – don’t forget to apply it to something!

Did you find this hint useful? Are you looking to learn more? Well, here’s a hand-picked selection of a few books that I’ve found useful over the years:


Windows Server 2003 for Dummies

Mastering Windows Server 2003

Introducing Windows Server 2008

Windows Server 2008 for Dummies

phirebird