May 22 2009

2008 Server DFSR Replication Problems

I have used DFSR for some time now and had only great experiences with it, however it was low volumes of data, This time I was implementing this as a High availability solution for a web farm, We had about 40 gigs of data with a massive amount of files to replicate…. But the scheme of things 40 gig of data is really not that much.

Anyways cutting to the point after reading articles about the best way to proceed with a quick initial replication was said to be copy the files to the destination server, so I did this via robocopy, keeping all attributes and the permissions intact.

However contrary to popular believe this was what ultimately caused so much grief, as it started the replication off and I my event log was filling up with:

Event Type: Information
Event Source: DFSR
Event Category: None
Event ID: 4412
Date: <Date>
Time: <Time>
User: N/A
Computer: <Computer name>
Description:
The DFS Replication service detected that a file was changed on multiple servers. A conflict resolution algorithm was used to determine the winning file. The losing file was moved to the Conflict and Deleted folder.
Additional Information:
Original File Path: <File path>
New Name in Conflict Folder: <Folder name>
Replicated Folder Root: <Folder name>
File ID: <File ID>
Replicated Folder Name: <Folder name>
Replicated Folder ID: <Folder ID>
Replication Group Name: <Replication group name>
Replication Group ID: <Replication group ID>
Member ID: <Member ID>

see more about this here: http://support.microsoft.com/kb/944804

After further investigation, this was because the file ID of the files on the destination server differed from the source server…. Thanks robocopy.

This was filling up my ClonflictAndDeleted folder very quickly, with a lot of what I though was unnecessary crap. Never the less I let it run for a few days and I cam back to find the below event log:

Source : DFSR

Catagory : None

Event ID : 2104

Type: Error

Description :

The DFS Replication service failed to recover from an internal database error on volume F:. Replication has been stopped for all replicated folders on this volume.

Additional Information: Error: 9203 (The database is corrupt (-1018)) Volume: DB587759-DC0B-11DC-940D-00304888DB13 Database: F:\System Volume Information\DFSR

 

Brilliant I had a corruption

 

Possible Solutions


Taken from Google Groups [1]

I recently had a spat with the "new and improved" DFSR and wanted to let everybody in on the proceedure for reseting a DFSR member.

First off, removing everything using the GUI doesn’t help when the database is corrupt. DFSR keeps the database regardless of its membership status. So if for example you had a broken DFSR server and removed it from every replication group, when you added it back you’d still be out of luck.

To clear it completely after the server is no longer a member of *any* dfsr replication group (i.e. remove it from all of them in the gui and wait for AD replication to propgate the changes):

1. Stop the "DFS Replication" service.

2. On the drive(s) in question, grant yourself full permission to the hidden system "System Volume Information" folder.

3. Navigate into the folder and delete (or move to be extra careful) the DFSR folder.

4. Navigate to each replication group the server was a member of and delete (or move to be extra careful) each hidden system "DfsrPrivate" folder.

5. Start the "DFS Replication" service.

You may now treat the server as a brand new member for the replication groups. Now all you need to deal with is DFSR’s sloppy initial replication routines (hint: those missing files are in the "DfsrPrivate \PreExisting" folder).

 

http://www.eventidwiki.com/index.php?title=Event_ID_:_2104%2C_DFSR

 

However this did not work the folder would not rename under 2008 even with UAC off, this did work for me though

1. Click Start, right click Command prompt and click run as administrator to open a command prompt window, then go to driverletter:\System Volume Information\dfsr prompt, type the command below to rename it:

Ren “old folder name” “new folder name”

I did this on both servers participating in the replication. further to this I deleted the folder I was replicating on the destination server, and let DFS do all off the creating.

after 2 days I had a fully functional DFSR, working the way it should!!!!!

Some commands I found useful through the process:

dfsrdiag backlog /rgname:”cluster replication” /rfname:websites /rmem:RECEVINGSERVER /smem:SENDINGSERVER >c:\backlog1.txt

You might also find the %systemVolume%windows\debug folder useful.

 

Good Luck.


May 14 2009

Windows Mobile 6.5 vs 6.1 – Added features

So the question on many peoples lips is it worth the upgrade???

For me the answer is YES absolutely!

While I know its still beta for many phones, I like many other WM enthusiasts have been able to get our 6.5 ROMs from http://xda-developers.com, So we have first hand experience with WM 6.5.

I have now been using WM6.5 full time now for a few months, while I see Microsoft have made some necessary changes in order to keep up with the ever so popular Iphone, some of these changes include:

  • Most menus are now finger friendly for those with fatter fingers (like myself)
  • Scrolling throughout the whole WM platform is now fluid like the Iphone.
  • They have removed the start menu where it would drop down like the current windows platform (W7, VISTA, XP etc), where it appears in a honeycomb effect, again this if finger friendly.
  • Windows Locking, they have taken a leave out of apples book here, and they now also have the slide to unlock function
  • They have now incorporated widgets with this release (further blogs to come on this)
  • It also appears that customisations to the phone skin / theme are easier than ever, and now your able to incorporate images within the taskbars with transparency. this give the phone a 21st century look about it!!!
  • And last but not least the biggest change is the home screen, now referred to as titanium, this is one screen that allows you to manage almost everything from the one screen, The Idea is similar to HTC’s Touchflo, in a round about way.
  • Battery life has been increased

they say pictures are worth a thousand words so less talk and more pics:

 

2009 05 14_12 25 59_0000_111d
The honeycomb, this is modified, normally it is large only 3 Icons across
2009 05 14_12 31 51_0004_111d
The  Slide to unlock
2009 05 14_12 35 00_0005_111d
Titanium weather
2009 05 14_12 35 50_0006_111d
Titanium Home
2009 05 14_12 38 25_0007_111d
Email / SMS / MMS screen you can see a new scroll bar, and the items are MUCH larger to click on, as you can see the highlight is customisable to a degree. The scroll in here is SO much more fluid like the IPhone.
2009 05 14_12 46 36_0020_111d
New IE, better but far from perfect, Opera is still miles ahead
2009 05 14_12 46 23_0019_111d IE without all the bars, works like opera, but not nearly as smooth, also doesn’t render website correct

While I have given it praise there is still a major down side I think…

It looks and works the same way, its RAM and ROM hungry, Microsoft have only bandaid the old interface.

However combined with HTC’s great new TouchFlo 3d (TF3d)version 2 (not officially release either) it seems they have fixed pretty much every menu that is commonly used to be very finger friendly, while they did this with the basics on TF3D v1, in V2 they have gone way beyond, fixing most menus. So with TF3D2 combined with 6.5 its not at all a bad package. I will be looking forward to both TF3Dv2 and 6.5 come out of beta.

 

(All new devices with 6.1 shipped will be eligible for a 6.5 upgrade, older phones while you might find a copy of 6.5 on http://xda-developers.com, don’t expect it to fly, also your vendor will not support it!)


Apr 15 2009

Windows Mobile Wrong time zone

I have just done a ROM update on my windows mobile enabled device and while there are many new features, and the integration to hide a lot the old and ugly windows mobile interface is superb, however there is a few things lacking the most important is the Time Zone. While it seems to pick up your timezone based on weather points you use at first. for example Las Vegas GMT –8. Although after entering in Sydney (where I am based) it would at best come up with a +11 naturally this would through the clock out 1 hour.

So if you are having problems with your time zone I suggest the first steps

That seems to fix the bulk of the issues going around with the Windows mobiles, however if you like me have updated your ROM and there seems to no avail in sight.

If your in a +10 time zone your in luck

Here is a registry entry for +10

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\Time]

"TimeZoneInformation"=hex:A8,FD,FF,FF,53,00,79,00,64,00,6E,00,65,00,79,00,20,00,53,00,74,00,61,00,6E,\

      00,64,00,61,00,72,00,64,00,20,00,54,00,69,00,6D,00,65,00,00,00,00,00,00,00,\

      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,05,\

      00,03,00,00,00,00,00,00,00,00,00,00,00,53,00,79,00,64,00,6E,00,65,00,79,00,\

      20,00,44,00,61,00,79,00,6C,00,69,00,67,00,68,00,74,00,20,00,54,00,69,00,6D,\

      00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

      00,00,00,00,0A,00,00,00,05,00,02,00,00,00,00,00,00,00,C4,FF,FF,FF

**Copy and save this file as a .REG (yes you can import a registry key in windows mobile) to import the REG file you will need this app – http://www.pocketpcfreeware.mobi/download-task-manager.html

For those with other time zones if you have another mobile device, or an  emulator, you can always change the time zone to the correct location and then from the registry location of ‘HKEY_LOCAL_MACHINE\Time\TimeZoneInformation’ you should be able to copy and replace this on your PDA then your good to go.

 

**NOTE any registry changes are made at your own risk, I take no liability for any damage.


Mar 30 2009

Outlook 2007 constantly consuming 50% + CPU

Just a quick one today. I was recently given a high spec notebook that each time on load with outlook it would consume 50% or more of the CPU.

So I thought it might be a good idea to post on my findings.

 

1. First thing was to disable any and all third party comm add-ins

you can easily find these in tools > Trust Center >  Add in tab (to the left) > click on Go (at the bottom)

Restart outlook.

 

If you still have a high utilization then like me you might be scratching you head.

 

Open outlook and check the calendar, if there are multiple cleaners open close them all off and close outlook and open again.

For me that resolved the issue, the user had about 7+ calendar items open at all times, this is why outlook seemed to be hogging so many resources.

 

Hope this helps


Mar 6 2009

Fix: Windows Mobile Memory Leak

Summary:
Release memory on your HTC Touch Diamond/Pro devices (Windows Mobile), It is a memory reclaimer similar to Oxios but with advanced settings and actually works! this applications is specially for diamond/pro devices! Great solution for the Windows Mobile memory leak problem.

Description:
htcAddicts developed a very useful tool for HTC Touch Diamond/Pro called “cleanRAM”.
The cleanRAM attempts to release as much memory as possible without damaging the internal state of the Windows Mobile device. it’ll refresh/recover your device RAM. This can save you a lot of SOFT RESET!

Configuration Menu:
There are 3 levels of cleaning and Personally customized processes list.
Level 1 – Basic purge only (quick) – Close non-responding tasks without TouchFLO 3D interface
Level 2 – Quality purge – Recommended for best performance
Level 3 – Fundamental purge (time-consuming) – Reset non-responding tasks and services
Personally customized processes list – Select the processes you wish to close
Also you can find:
1. RAM status notification (in the end of the cleaning) (On/Off)
2. Restart Processes Mode (On/Off)
3. Show Hidden Processes (On/Off)

Changelog:
Version 1.0.4 – Fixed: about screen + small issue (nk.exe error msg) for htc touch pro users
Version 1.0.3 – Added: all registry settings is now in the archive/installation file (cab) + new icon for “cleanRAM config” shortcut (red)
Version 1.0.2 – Fixed: application shortcuts doesn’t appears (on some devices)
Version 1.0.1 – Fixed: some small issues with Level 1
Version 1.0.0 – Added: “Reset Processes Mode” new feature with restart time chooser
Version 0.9.5 – Added: “Show Hidden Processes” new feature to show all processes (including services. dangeros!)
Version 0.9.2 – Fixed: problem with “RAM Status Notification” screen and other small issues

What’s next:
1. Auto Schedule – I don’t know if this feature possible but I promise to check it
2. Custom mode: two different tables mode, one with restart applications and the other with kill applications
3. Solve some memory small issue (Level 3)
4. Fix the shortcut problem after install (Solved!)

Installation Instructions:
1. Download the attached .cab file from http://www.htcaddicts.com/?id=65.
2. Copy this file to some temporary folder in your device.
3. Execute it from your device (recommend you install to device memory).
* The cleanRAM will install into /Program files/htcAddicts.
* There is also a two links to “cleanRAM Config” (configuration tool) and “cleanRAM” (is the actual memory reclaimer) in the Start > Programs

Requirements:
HTC Touch Diamond/Pro with Microsoft Windows Mobile 6.1
Microsoft .NET Compact Framework 3.5

[Download .NET]
Use cleanRAM at your own risk!!! NO WARRANTY!!!

Download:
http://www.htcaddicts.com/?id=65
[Google Translated]

 

A big Thanks to www.htcAddicts.com for this awesome APP, it works flawlessly, I tried it on setting 1, it gave back 20MB of memory back!!!

 

Original Post can be found here: http://forum.xda-developers.com/showthread.php?t=487490


Mar 3 2009

Exchange 2007 Offline Address Book (OAB) keeps asking for authentication

If you are getting a constant authentication box pop up for your users when outlook is trying to connect to the Offline Address book, then read on, I am sure this will help you:

First thing is first make sure you have a vaild OAB

1. open Exchange Management console

2. open organization Configuration > Go to mailbox > choose Offline address book tab.

3. Make sure you have at least one address book here if not create one.

4. Right click on the address book go to properties > distribution Tab . ensure all boxes are ticked. > click on the ADD here you need to locate the appropriate server. > hit Ok.

5. You should be back to the OAB listings, if you have more then one that’s fine leave them for the time being, but choose the one you would like to be the default OAB and right click on it and choose ’set as default’

6. Now we need to update this OAB, right click on the default OAB you have created and then choose ‘update’

7. to ensure that the OAB has updated go to the event viewer and check the application log.

If you get a successful update great move on to step 9

if you get a warning with this event log below:

Log Name:      Application
Source:        MSExchangeSA
Date:          3/03/2009 9:10:24 AM
Event ID:      9320
Task Category: OAL Generator
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      server.domain.com.au
Description:
OALGen could not generate full details for some entries in the offline address list for address list ‘\Global Address List’.  To see which entries are affected, event logging for the offline address list generator must be set to at least medium.
- xxxxxxx Offline Address Book
Event Xml:
<Event xmlns="
http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="MSExchangeSA" />
    <EventID Qualifiers="32768">9320</EventID>
    <Level>3</Level>
    <Task>13</Task>
    <Keywords>0×80000000000000</Keywords>
    <TimeCreated SystemTime="2009-03-02T22:10:24.000Z" />
    <EventRecordID>14197</EventRecordID>
    <Channel>Application</Channel>
    <Computer>server.domain.com.au</Computer>
    <Security />
  </System>
  <EventData>
    <Data>\Global Address List</Data>
    <Data>xxxxxx Offline Address Book</Data>
  </EventData>
</Event>

 

You need to set the event logging a little higher to do this open up the exchange powershell console and run the below command:

Set-EventLogLevel -Identity "MSExchangeSA\OAL Generator" -Level Expert

Now repeat step 7

you should now have some errors

event ID: 9330 MSExchangeSA

OALGen encountered error 80040115 (internal ID 50004ef) accessing Active Directory servername for ”.
- /o=Elcom Technology Pty Ltd/cn=addrlists/cn=oabs/cn=xxxxxx Offline Address Book

 

and

Event ID 9334 MSExchangeSA

OALGen encountered error 80040115 while initializing the offline address list generation process. No offline address lists have been generated. Please check the event log for more information.
- /o=Elcom Technology Pty Ltd/cn=addrlists/cn=oabs/cn=xxxxx Offline Address Book

 

8. If these are the same kind of errors you must open ADSIedit (only included in the support package supplied by micorosft)

once you have installed the support tools

start > run > adsiedit.msc

go to

Using ADSIEdit:
1. Navigate to the ‘Default Global Address List’ object
CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=local
2. Go to the properties of the ‘Default Global Address List’ object
3. Copy the distinguishedName attribute of the ‘Default Global Address List’.
It should look similar to the one below.
CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=local
4. Navigate to the ‘Microsoft Exchange’ container.
CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Domain,DC=local
5. Go to properties of the ‘Microsoft Exchange’ container
6. Select the GlobalAddressList attribute and click Edit.
7. Paste in the distinguishedName attribute of the ‘Default Global Address List’ and click Add
8. Click OK twice to close out of the properties.
9. Replicate domain controllers
10. Rebuild the OAB again

above taken from http://forums.msexchange.org/m_1800488370/tm.htm

 

9. Check your permissions on your OAB go to c:\Program Files\Microsoft\Exchange Server\Client Access\OAB\ find the correct GUID that related to your OAB, right click on the GUID and then go to the security tab. Ensure that administrators and system have full control and authenticated users have only read access. (leave the other permissions)

—- you can use this command to find out

get-offlineaddressbook | fl > c:\OAB_Version.txt

 

10. Ensure that the OAB has populated with an XML file you can find this in :\Program Files\Microsoft\Exchange Server\Client Access\OAB\GUID_here\oab.XML.

If you have not got an XML file the OAB has not populated revist your event viewer.

 

11. Now in IIS you should have an OAB virtual directory if you do not you must create this use the below

New-OABVirtualDirectory -DomainController <Fqdn> -ExternalUrl <Url> -InternalUrl <Url> -Path <String> -PollInterval <Int32> -RequireSSL <$true | $false> -Server <ServerIdParameter> -WebSiteName <String>

more info here: http://technet.microsoft.com/en-us/library/aa996917.aspx

If you do already have the virtual directory Change that virtual directory to an application.

That’s it, everything should work now!

this took me 2 days to work out and all it really was, was that darn virtual directory set by MS as default.

I hope I save someone the pain and frustration I went through with solving this.


Feb 23 2009

Enable Pop on Exchange Server 2007

We have just finished our Exchange 2007 server migration and it went rather well, however there where a few  things that I thought I would share that had me stumped for a while.

So Exchange 07 doesn’t initialise Pop by default, while you will see all accounts will be enabled for Pop by default, but the pop service must be started

there are 2 ways of doing this

1. through the GUI

or

2. Through powershell

Seems like powershell is the best method, why? Simply because exchange 07 relies heavily on powershell so its a good place to familiarise yourself if you haven’t started already.

 

through the GUI

start > run type ’services.msc’ > find ‘Microsoft Exchange POP3′ and start this

You will also want to change it from manual to Automatic if you have server 08 you may also want to change this to auto (delayed start) I have done this as Pop is not as vital as other services on the exchange.

Through powershell – Exchange console (recommenced)

set-service msExchangePOP3 -startuptype automatic

start-service -service msExchangePOP3

 

No that should be about it, your ready to go that’s not so hard at all.

BUT if you have configured this and you are getting the authentication box constantly popup as if its not authenticating then your not finished read on:

First this is first go to the mailbox and ensure that the mailbox has POP enabled.

 

through the GUI

Recipient Configuration > Mailbox > find your mail box and then right click properties > Mailbox features you can enabled and disable here

 

Through Console

set-CASMailbox -Identity MailboxNameHere -popEnabled $true

 

If this is enabled then your authentication is set incorrectly.

"Under a default Exchange 2007 installation, IMAP and POP3 only work when the connection from the client is secured. For many organizations, this is not a desirable configuration."

We must allow for allow plain text logins

this can only be done as far as I know through the console using the below command

 

Set-PopSettings -LoginType PlainTextLogin

Now for this to take effect you must restart your ‘Microsoft Exchange POP3′ Service.

 

Now you can enjoy pop again.


Jan 30 2009

Prepare for 2007 Exchange Server install

I thought I would blog about this, because we had so many issues, and I found Microsoft’s documentation to be rather poor on this occasion.

However it does explain the steps that need to be done in order to prepare (just not how to execute them easily)

So best to start with a quick read of the article

http://technet.microsoft.com/en-us/library/bb125224.aspx

If you’re not patient and want to skip (little like me) then the steps are in short.

 

  1. setup /PrepareLegacyExchangePermissions: <domain name here>
    or
    setup /pl <domain name here>
  2. Setup /PrepareSchema
    or
    setup /ps
  3. Setup /PrepareAD [/OrganizationName: <organization name> ]
    or
    setup /p [/on:<organization name>]
  4. Setup /PrepareDomain
    or
    setup /pd

 

In order to run these commands you must run them from the command prompt on a server that is apart of the domain you are preparing, ensure you have the exchange 07 cd in the dvd drive and <DVD drive letter> then dir ensure you see the ’setup.exe’ and ’setup.com’ files in the DVD drive these should be in the root directory of the DVD

 

Now run the commands.

If you are unlucky like me you will get a few errors like:

"Exchange 2007 cannot be used with the version of Windows operating system running on this computer."

there are 2 possible reasons that this could happen for

you are trying to run the setup file which is a x64 bit file on a x86 system, you can not do this.

the other reason is that you are running the setup commands on a 2008 server, and you may be running exchange 2007 install not the exchange 2007 SP1. (2008 server requires SP1)

So if you are like us in the postion where you have many x64 bit 2008 servers but no x64 2003 servers then you’re going to have to download the 32 bit Exchange 2007 Management tools

get it from here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=6be38633-7248-4532-929b-76e9c677e802&displaylang=en

the download is an EXE so I suggest installing winRAR and extracting it rather than installing it (unless you will use it), once extracted you will have the setup files, you can now run all of your prep on a x86 system.

 

Another good resource is this: http://support.microsoft.com/default.aspx/kb/555854


Jan 15 2009

IIS7 logging in Central Location for web farms

 

 

 

 

 

 

Ok so it appears IIS7 has thought of almost everything this time, and IIS7 is perfect for web Farms now they have the ability to share the configuration file.

While we are in the mists of setting up a load balanced environment with a IIS7 farm, we have everything working wonders. But when it comes to log files it seems Microsoft missed this. they really should have added in the functionality to combine log files to a central location, while we can prove a UNC path and also log to this, but only one server can do this.

the problems that you are faced with in a web farm is that:

If you have shared you ApplicationHost.config which in a web farm, (I highly recommend you do to make your life that little be easier) you will find that y our log file location will be the same on all servers. which could be a problem if:

you have used a UNC path, all servers in the farm will try and log to this location and only one can win, as the HTTP.SYS for that winning server will keep this open and therefore other servers will not be able to log.

If you have specified a local path, which really lest face it is your only option, you MUST make 100% sure that location or that drive exists on all of your servers in the web farm.

Now if you don’t care so much for your log files you will be happy to have them on each server and not collate them. But for the people like us we need them in a central location for a: We like to find our data quickly and be able to find what is going on, on our servers b; we have webstats that we need to be able to provide to our clients or internal staff and c; for a backup / management purpose its just easier to have them centralised.

So our requirement is to be able to copy all of our log files to one location, keeping of course the web log file structure i.e. W3SVC1, W3SVC2 etc…

there is one other problem I should tell you, all of the log file names are the same name, so we can just schedule a move / copy script because they will fail or overwrite the other log files, you MUST rename the files before moving. In hind sight we have do this but its a good idea anyway, because this will allow us to easily track down a problem on a server via the logs.

So we have come up with a script that can be scheduled on a daily basis that will rename all files to the server name_<orginalfilename>.log (this will look in all sub folders i.e. W3SVC1, W3SVC2 etc…) once the name change is done it will then MOVE the files to the central location.

A Big thanks to Alan Lee for this script, as he wrote the find and replace part (hats off)

 
set logs=C:\folder\folderagain
cd /d %logs%
 
dir /b %logs% > tmp.txt
 
for /D %%I in ("%logs%") do For /F "tokens=*"  %%J in (tmp.txt) do cd /d %logs%\%%J && for %%i in (u*.log) do move %%i %computername%_%%i 
 
del %logs%\tmp.txt
 
robocopy %logs% \\servername\FolderName /mov /E /minage:0 /R:3 /W:5 /LOG:%logs%\logs.log
 
 

Of course the script uses robocopy so you will need to include the .exe for this where ever you are executing this .bat from.

With 2008 Server you can also schedule emails with attachments, might not be a bad idea to attach the log file so you can archive it away.


Jan 8 2009

AD Based Outlook Email Signature for 2003 and 2007 Part 4 – Now writes TXT and RTF as well as HTML – Revised.

(This is a continuation of http://bradmarsh.net/index.php/2008/11/20/ad-based-outlook-email-signature-for-2003-and-2007-part-4-now-writes-txt-and-rtf-as-well-as-html/)

Ok due to various people having problems with the RTF, where it might show the HTML rather then display correctly, Also it has come to my Attention RTF (not always) will not show images or wont handle them to well.  Other problems where it might not show in outlook also.

anyway’s this has been tested and all above issues seem to be resolved at least for me :)

The below is the new section:

What we are doing here in short is copying the .txt file we have created and then taking the text file and formatting this into something a little more presentable.

'===========================================================================
' Formats the RTF
'===========================================================================
Const wdExtend = 1 
'const wdStory = 6
'const wdMove = 1
 
 
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
'Be sure to change the file name to your desired name
Set objDoc = objWord.Documents.Open(Folderlocation & "Elcom.rtf")
Set objSelection = objWord.Selection
 
set objSelection = objDoc.Range()
'objDoc.Range()
'objSelection.HomeKey wdExtend
 
'you can add more functions IE Bold, underline, different font etc
objSelection.Font.Size = "10"
objSelection.Font.Name = "Arial"
 
'Save the file
'Be sure to change the file name to your desired name
objDoc.SaveAs Folderlocation & "Elcom.rtf", RTF
 
 
' Close the active document
objDoc.Close
 
'Close Word
objWord.Quit

I have used the TXT file, as this removes any images that might become broken. As I originally tried copying the HTML to get the colours and other items. However to do this I would have to call a .exe file that would convert HTML to RTF. This is all fine, but it creates a more complex script, which is something I really wanted to avoid.

However it would be obviously the optimal way of doing it, this way we get a nice looking RTF with colour.

I might still do this, but I with the HTML to RTF converter I do have it will not do images.

If you know of a good HTML to RTF converter that can be called as a .exe then let me know and I might just do the script, otherwise this is the best that I can do for the time being.

Here is the complete new code:

'====================
'
' VBScript: <Signatures.vbs>
' AUTHOR: Peter Aarts
' Contact Info: peter.aarts@l1.nl
' Version 2.04
' Date: January 20, 2006
' Moddified By Brad Marsh Now works with both 2003 and 2007 outlook 
' Contact: gentex@tpg.com.au
' Date 19 feb 08
' Tested on Vista, XP, XP64 and office 2003 and 2007. 
' NOTE will not work that well with various email accounts\
' modified: 8 Jan 09 - Brad Marsh
' added more support for RTF, copies TXT pulling out images and allows for formatting
'====================  
 
'Option Explicit
On Error Resume Next  
 
Dim qQuery, objSysInfo, objuser
Dim FullName, EMail, Title, PhoneNumber, MobileNumber, FaxNumber, OfficeLocation, Department
Dim web_address, FolderLocation, HTMFileString, StreetAddress, Town, State, Company
Dim ZipCode, PostOfficeBox, UserDataPath  
 
' Read LDAP(Active Directory) information to asigns the user's info to variables.
'====================
Set objSysInfo = CreateObject("ADSystemInfo")
objSysInfo.RefreshSchemaCache
qQuery = "LDAP://" & objSysInfo.Username
Set objuser = GetObject(qQuery)  
 
FullName = objuser.displayname
EMail = objuser.mail
Company = objuser.Company
Title = objuser.title
PhoneNumber = objuser.TelephoneNumber
FaxNumber = objuser.FaxNumber
OfficeLocation = objuser.physicalDeliveryOfficeName
StreetAddress = objuser.streetaddress
PostofficeBox = objuser.postofficebox
Department = objUser.Department
ZipCode = objuser.postalcode
Town = objuser.l
MobileNumber = objuser.TelephoneMobile
web_address = "http://www.elcom.com.au" 
 
' This section creates the signature files names and locations.
'====================
' Corrects Outlook signature folder location. Just to make sure that
' Outlook is using the purposed folder defined with variable : FolderLocation
' Example is based on Dutch version.
' Changing this in a production enviremont might create extra work
' all employees are missing their old signatures
'====================
Dim objShell, RegKey, RegKey07, RegKeyParm
Set objShell = CreateObject("WScript.Shell")
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General"
RegKey07 = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General"
RegKey07 = RegKey07 & "\Signatures"
RegKey = RegKey & "\Signatures"
objShell.RegWrite RegKey , "AD_elcom"
objShell.RegWrite RegKey07 , "AD_elcom"
UserDataPath = ObjShell.ExpandEnvironmentStrings("%appdata%")
FolderLocation = UserDataPath &"\Microsoft\AD_elcom\"
HTMFileString = FolderLocation & "Elcom.htm"  
 
' This section disables the change of the signature by the user.
'====================
'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\NewSignature" , "L1-Handtekening"
'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\ReplySignature" , "L1-Handtekening"
'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD"  
 
' This section checks if the signature directory exits and if not creates one.
'====================
Dim objFS1
Set objFS1 = CreateObject("Scripting.FileSystemObject")
If (objFS1.FolderExists(FolderLocation)) Then
Else
Call objFS1.CreateFolder(FolderLocation)
End if  
 
' The next section builds the signature file
'====================
Dim objFSO
Dim objFile,afile
Dim aQuote
aQuote = chr(34)  
 
' This section builds the HTML file version
'====================
Set objFSO = CreateObject("Scripting.FileSystemObject")  
 
' This section deletes to other signatures.
' These signatures are automaticly created by Outlook 2003.
'====================
Set AFile = objFSO.GetFile(Folderlocation&"Elcom.rtf")
aFile.Delete
Set AFile = objFSO.GetFile(Folderlocation&"Elcom.txt")
aFile.Delete  
 
 
'=========================================================
' This adds the Text file, will need to be changed accordingly
'==========================================================
 
Set objFile = objFSO.CreateTextFile(Folderlocation&"Elcom.txt",True)
objfile.writeLine ""& FullName & " | " & title & " |  " & title & " | "& Company & " | Australian Technology Park" 
objfile.writeLine "T +612 " & PhoneNumber & " | F +612 9209 4423 | www.elcom.com.au | " & Email &" "
objfile.writeLine " "
objfile.writeLine " "
objfile.writeLine "--------------------------------------------------------------------------------"
objfile.writeLine "This email is intended for the intended recipients(s) and may contain confidential information. "
objfile.writeLine "Reproduction, dissemination or distribution of this message is prohibited unless authorised by the sender."
objfile.writeLine "If you are not the intended recipient, please notify the sender immediately and you must not read,"
objfile.writeLine "keep, use, disclose, copy or distribute this email without the sender's prior permission."
objfile.writeLine "The views expressed by the sender are not necessarily those of Elcom Technology Pty Ltd "
objFile.Close
 
 
Set objFile = objFSO.CreateTextFile(HTMFileString,True)
objFile.Close
Set objFile = objFSO.OpenTextFile(HTMFileString, 2)  
 
objfile.write "<!DOCTYPE HTML PUBLIC " & aQuote & "-//W3C//DTD HTML 4.0 Transitional//EN" & aQuote & ">" & vbCrLf
objfile.write "<HTML><HEAD><TITLE>Microsoft Office Outlook Signature</TITLE>" & vbCrLf
objfile.write "<META http-equiv=Content-Type content=" & aQuote & "text/html; charset=windows-1252" & aQuote & ">" & vbCrLf
objfile.write "<META content=" & aQuote & "MSHTML 6.00.3790.186" & aQuote & " name=GENERATOR></HEAD>" & vbCrLf
objfile.write "<body>" & vbCrLf
objfile.write "<font color=696969 face=" & aQuote & "Arial" & aQuote & "><h6> "& FullName & " | " & title & " | "& Company & " | Australian Technology Park <br>"& vbCrLf
objfile.write "T +612 " & PhoneNumber & " | F +612 9209 4423 | <a href=http://www.elcom.com.au><font color=#696969>www.elcom.com.au</font></a> |<a href=mailto:" & Email &" > <font color=#696969>" & Email &" " & vbCrLf
objfile.write "</h6></font></a></B>" & vbCrLf
objfile.write "</font>" & vbCrLf
objfile.write "<font color=696969 face=arial><A href=http://www.elcom.com.au/> <img src=http://www.elcom.com.au/images/elcom-logo-web-175x70.gif border=0></a>" & vbCrLf
objfile.write "<br>" & vbCrLf
objfile.write "<img src=http://www.elcom.com.au/images/mspartner.jpg>" & vbCrLf
objfile.write "<br>" & vbCrLf
objfile.write "</font><font color=696969 size=1 face=arial><br>" & vbCrLf
objfile.write "<hr size=1 align=left width=465 color=696969>" & vbCrLf
objfile.write " This email is intended for the intended recipients(s) and may contain confidential information. <br> Reproduction, dissemination or distribution of this message is prohibited unless authorised by the sender.<br> If you are not the intended recipient, please notify the sender immediately and you must not read,<br> keep, use, disclose, copy or distribute this email without the sender's prior permission.<br> The views expressed by the sender are not necessarily those of Elcom Technology Pty Ltd</font>"  & vbCrLf
objfile.write "</FONT></BODY></HTML>" & vbCrLf
objFile.Close
 
 
'==========================================================================
' This copies the .htm file and changes it to a RTF format
'==========================================================================
'Set the Source and Destination paths below - CHANGE your file name
'----------------------------------------------------
 
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile Folderlocation & "Elcom.txt" , Folderlocation & "Elcom.rtf", OverwriteExisting
 
 
 
'===========================================================================
' Formats the RTF
'===========================================================================
Const wdExtend = 1 
'const wdStory = 6
'const wdMove = 1
 
 
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
'Be sure to change the file name to your desired name
Set objDoc = objWord.Documents.Open(Folderlocation & "Elcom.rtf")
Set objSelection = objWord.Selection
 
set objSelection = objDoc.Range()
'objDoc.Range()
'objSelection.HomeKey wdExtend
 
'you can add more functions IE Bold, underline, different font etc
objSelection.Font.Size = "10"
objSelection.Font.Name = "Arial"
 
'Save the file
'Be sure to change the file name to your desired name
objDoc.SaveAs Folderlocation & "Elcom.rtf", RTF
 
 
' Close the active document
objDoc.Close
 
'Close Word
objWord.Quit
 
 
 
' ===========================
' This section readsout the current Outlook profile and then sets the name of the default Signature
' ===========================
' Use this version to set all accounts
' in the default mail profile
' to use a previously created signature  
 
Call SetDefaultSignature("Elcom","")  
 
' Use this version (and comment the other) to
' modify a named profile.
'Call SetDefaultSignature _
' ("Signature Name", "Profile Name")  
 
Sub SetDefaultSignature(strSigName, strProfile)
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."  
 
If Not IsOutlookRunning Then
Set objreg = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows NT\" & _
"CurrentVersion\Windows " & _
"Messaging Subsystem\Profiles\"
' get default profile name if none specified
If strProfile = "" Then
objreg.GetStringValue HKEY_CURRENT_USER, _
strKeyPath, "DefaultProfile", strProfile
End If
' build array from signature name
myArray = StringToByteArray(strSigName, True)
strKeyPath = strKeyPath & strProfile & _
"\9375CFF0413111d3B88A00104B2A6676"
objreg.EnumKey HKEY_CURRENT_USER, strKeyPath, _
arrProfileKeys
For Each subkey In arrProfileKeys
strsubkeypath = strKeyPath & "\" & subkey
objreg.SetBinaryValue HKEY_CURRENT_USER, _
strsubkeypath, "New Signature", myArray
objreg.SetBinaryValue HKEY_CURRENT_USER, _
strsubkeypath, "Reply-Forward Signature", myArray
Next
Else
strMsg = "Please shut down Outlook before " & _
"running this script."
MsgBox strMsg, vbExclamation, "SetDefaultSignature"
End If
End Sub  
 
Function IsOutlookRunning()
strComputer = "."
strQuery = "Select * from Win32_Process " & _
"Where Name = 'Outlook.exe'"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery(strQuery)
For Each objProcess In colProcesses
If UCase(objProcess.Name) = "OUTLOOK.EXE" Then
IsOutlookRunning = True
Else
IsOutlookRunning = False
End If
Next
End Function  
 
Public Function StringToByteArray _
(Data, NeedNullTerminator)
Dim strAll
strAll = StringToHex4(Data)
If NeedNullTerminator Then
strAll = strAll & "0000"
End If
intLen = Len(strAll) \ 2
ReDim arr(intLen - 1)
For i = 1 To Len(strAll) \ 2
arr(i - 1) = CByte _
("&H" & Mid(strAll, (2 * i) - 1, 2))
Next
StringToByteArray = arr
End Function  
 
Public Function StringToHex4(Data)
' Input: normal text
' Output: four-character string for each character,
' e.g. "3204" for lower-case Russian B,
' "6500" for ASCII e
' Output: correct characters
' needs to reverse order of bytes from 0432
Dim strAll
For i = 1 To Len(Data)
' get the four-character hex for each character
strChar = Mid(Data, i, 1)
strTemp = Right("00" & Hex(AscW(strChar)), 4)
strAll = strAll & Right(strTemp, 2) & Left(strTemp, 2)
Next
StringToHex4 = strAll  
 
 
End Function

Enjoy