Dec 17 2009

Windows Live Mail Backup

With the release of windows 7, they have no longer included a default windows mail client for the first time, in as long as I can recall.

So if you got use to outlook express or windows mail in VISTA, then you might want to get your hands on Windows Live Mail, very similar to windows mail in terms of interface, but for multiple accounts, I find it actually surprisingly much easier to manager all my email accounts.

Though backing up data might be a little tricker, here is a quick easy guide to follow

http://liveunplugged.spaces.live.com/blog/cns!F92775FC46A390CA!174.entry


Nov 25 2009

DotNetNuke REAL replacement menus

Finally some one has cracked it, they have made an easy to use and style menu replacement. Your probably about to say but there are hundreds or Menu replacements for DotNetNuke (DNN) and yes there are, alot of which I have used, though none of them used DNN the existing styling.

The one I am most excited about was the drop in replacement for the Solpart menu, lets face it this was always the most style able and configurable menu that ever came out with std DNN, and SEO has always been a pain in the rear end with this menu.

So for people like me that have a stack of DNN sites that used the solpart menu simply for style purposes over SEO (which lets face it the avg person / client that knows nothing about what SEO is, wants looks over functionality).

I like the best of both world’s DDN Done Right (Mark Allan) has produced an awesome extension for DNN with a simple install and a simple change to the skin tag and hey presto your solpart menu retains its funky look as it did before and   you have some better overall SEO structured menus, True hyperlinks, and a better overall user experience.

No only Has Mark enhanced the solpart, he also added functionality to better DNN new default nav provider, and the ability to add some really cool menu over effects, using  JQuery

http://www.dnndoneright.com/Standard-DNN-menu-upgraded.T94.aspx(See bottom menu)

and further to that Mark has created Mega menus also, and look to be creating additional templates, I know I for one will be watching very closely to DDR’s site for further updates!

for more info keep an eye on Marks Blog

Download DDR’s Free menus here

Thanks for the FREE menus Mark


Nov 13 2009

Word, Excel 07 getting sharing violations on save

So we were getting various sharing volitions when trying to save some changes to an existing document, both on windows VISTA and windows 7, this started to become an annoyance, but let it go because it was only now and then. I found out it wasn’t isolated to me, turns out many others have been affected by this annoyance also.

So you might get error messages like "Your changes could not be saved to ‘Filename.xlsx’ but were save to a temporary document ‘CERSS322′ (this is a random string). Close the existing document, then open the temporary document and save it under a new name."

If you try and save it again you might also get "Your changes could not be saved to ‘Filename.xlsx’ because of a sharing violation. Try saving to a different file."

once again if you were to save it it might actually save correctly.

There was lots of talk about an Anti-Virus might actually open this file scanning it when you have it open hence the reason for the sharing violation, and this could be well possible, but its more likely to be the Windows  Desktop Indexing service., you could disable this though that might be a drastic measure. you can right click on the file and turn the indexing on that file off.

So to do this right click on the file giving you problems go to ‘Properties’  > click on the ‘Advanced’ button > removed the tick from ‘ Allow this file to have contents indexed in addition to file properties’

See images below for more info.

image

image


Oct 9 2009

OLE registration error occurred outlook 2003

So on your outlook 2003 your getting an ole registration error occurred. Well don’t stress, its an easy fix.

Close outlook 2003

Open start > Run > type:

regsvr32 %windir%\system32\ole32.dll

No open Outlook and try again…

Still not working?

then give this ago

Open Outlook again

  • click on the Send/Receive pull / Drop-down menu ( this is the same button which gives the error message, the pull down is located on the right side, its an arrow)
  • Choose Send/Receive Settings
  • Uncheck “Make This Folder Available Offline”
  • Now re-check “Make This Folder Available Offline” again

 

Done!


Jul 8 2009

Exchange 2007: Purge mailboxes

With 2003 Exchange purging users was super simple through the GUI, you simply ran your clean up agent after deleting the mailbox and then you saw the disconnected mailbox then right click and purge, it was effortless. 2007 is certainly not effortless but its not all that hard either, you just have to start using more PowerShell, which is not such a bad thing, so here is how:

Step 1

First thing is first, Find the mailbox you wish to delete within the console, once you have located the account right click and choose remove, be warned this will also remove the AD account associated with the mailbox if you only want to remove the mailbox then choose disable.

Ok so you have now disconnected the mailbox you can no longer see this in the mailbox list, and there is a good chance you cant see it in the disconnected Mailbox just yet either.

Step 2

Open PowerShell and run this

get-mailboxdatabase

This command will show you your database name, copy the database name and then issue the below command, replacing the MailboxDatabaseHere with your database name

Step 3

Clean-Mailboxdatabase "MailboxDatabaseHere"

This clean-Mailbox database is the same as the clean up agent that was found in 2003’s GUI, once you have successfully ran this command go back to the GUI and see if you can see the mailbox you removed in the ‘Disconnected Mailbox’, once you can see it you will be able to delete the mailbox if not see step 5.

Step 4

If you are unlucky and you cant yet see it then hit refresh in the right pane…. Still cant see it ok, open PowerShell once again and run the below command:

Get-MailboxStatistics | Sort-Object DisplayName -Descending | ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.V alue.ToKB()}},ItemCount

This will return a list of all mailboxes in alphabetic order

image

With this list locate the mailbox you have just removed, and take note of the ‘DisplayName’

Step 5

Now that we can see the mailbox here we need can then purge the mailbox do this by running the below command be sure to change ‘MailboxDatabaseHere’ to your Exchange database and also change the ‘DisplayName’ to your account name, found using the above script.

Remove-Mailbox -Database "MailboxDatabaseHere" –StoreMailboxIdentity DisplayName -confirm:$true

That’s it your mailbox is no longer you have successfully purged it, not so hard after all.


Jul 5 2009

Windows 7 – Shortcuts, hints and thoughts

Ok So I have installed windows 7 (7100) on my little EeePC 900, the EeePC has 2 gigs of RAM and a small 1.6 Atom, with this small combo 7 smashes the pre-installed XP.
Boot time is better by about 5 seconds and general performance to open applications and general processing is just far better, while it uses substantially more memory than XP, but lets face it all new entry level PC’s have 2 gigs of RAM these days.

But with saying that I would blame a lot of the memory usage on the rotten IE8 that is bundled with windows 7, I have many complaints about this browser, so rather than complain I am finding I am using Chrome more regularly, faster better on the memory and processor. MS if you read this use the KISS principle (Keep it simple stupid) Google has done this very well for years.

Anyways lets get to the shortcuts and handy little functions that windows 7 has added!

  • My absolute favourite function has to be the if you have multiple screen configurations, you can click on a maximise screen and drag it to your other screens. Previously we had to resize / minimize and then move the open window to a new screen and then maximize… very annoying.
  • Next is the many many windows short cut keys, also work with multiple monitors or even single display :
    • Windows key + Left: docks current window to the left side of the screen.
    • Windows key + Right: docks current window to the right side of the screen.
    • Windows key + Up: maximizes and/or restores foreground window.
    • Windows key + Down: minimizes active window.
  • Previously running an app in administrator was a right click, and then run as admin , while that still exists there is a quicker better way of doing this with keys: It’s now as easy as holding CTRL + SHIFT when you open the application.
  • Another one for those with multiple monitors: Windows + SHIFT + Left (or Right) will shift a window from monitor to monitor.

Some handy things windows 7 includes:

  • Windows 7 now includes Gabriola. This is an elaborate display typeface that takes advantage of OpenType layout to create a variety of stylistic sets.
  • Windows 7 now burns ISO files themselves instead of making us install unwanted third-party apps.
  • In the case that something happens to your system, you can make yourself a system repair disc. Just search “system repair disc” in the start menu.
  • For the advanced users finally a desktop OS that gives us the ability to setup software RAID, one of my favs!
  • Advance defrag for windows 7, read more here : http://blogs.msdn.com/e7/archive/2009/01/25/disk-defragmentation-background-and-engineering-the-windows-7-improvements.aspx
  • Multi-Threaded File copy, this is by use of the command line robocoy which is included within windows 7, this is something I personally use on a constant basis, and is very powerful, if you haven’t used this before you are missing out!
  • UAC is substantially improved, where there is no need to turn this off any more, it only disturbs you on install of applications. this is something I turned of on VISTA as soon as I could, but one windows 7 I Have found that its something that’s not annoying and have left it on its default setting. Its also now provides us with a toggle bar where we can increase or decrease the default UAC settings.
  • A new calculator- about time it only took about 10 years!
  • Owh yeah an codec’s to play AVI Divx and other regularly used formats FINNALY!!!!!!!
  • And the whole OS is touch friendly!

Another feature I will be talking about in more depth is the default install XP with program  integration as a virtual machine. I will be blogging about business reasons as to why corporate should go the distance and  install windows 7.

there is so much more they have done windows 7 is really all that and a bag of chips, its got my 2 thumbs up, I just hope they don’t bloat the final release with unnecessary junk


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.


Dec 15 2008

FREE ftp, ftps and sftp server that works!

Here @ my current work place Elcom we are heavy uses of FTP for various methods. However we have recently been asked to supply a client with a particular solution that requires a Secure FTP solution, while our current FTP allows FTPS (SSL) we wanted something will a little more security, so we opted to go the SSH route also known as SFTP, I have looked high and low for suitable FTP applications that have all protocols SFTP, FTPS and plain old FTP, I have since found that while there are many app’s that do this, some are just much too pricey and some well the interface is poorly thought out and hard to navigate through.

After hours of trailing paid software, I found that they just didnt do exactly what I required, or maybe what I expected.

So I when on the hunt again this time looking for GNU based software, and to my surprise I found one that has all protocols.

It has a simple but yet easy to navigate and work through, and even better it integrates with NT authentication, when I say NT authentication I am talking about Active Directory…. and its FREE.

It even Supports Virtual Directories.

While there could be more with users and assigning them specific paths, rather than global directories, I really can’t complain given its price tag.

FreeFTd can be found here

http://www.freeftpd.com


Dec 5 2008

SQL 2008: Modify Design in a Table is not permitted

When attempting to modify a table design (by right clicking on the table and select ‘design’) you get and error something along the lines of:

 

Saving change is not permitted. the changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that cant be re-created or enabled the option Prevent Saving changes that require the table to be re-created.

image

 

You can fix this quite easily by the following method

Tools Menu > Options > Designers > Untick ‘Prevent saving changes that require a table re-creation’

 

clip_image002[4]

Done


Nov 20 2008

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

Ok due to high demand, and for some very odd reason 2007 was not writing the .txt file and the .rtf.

Now I have implemented various changes so it does this, however due to time constraints its not as
automated as I would like, I will try to review this when I get some free time (hopefully :) ).

So if you are using the old script the only changes are:

‘=========================================================
‘ 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

as you can see I have had to write this out again (without the HTML tags), this is far from perfect but
it is a working fix for the time being. You will have to edit the above to suite your Text based
Signature.

Next addition is

‘====================================================
‘ 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.htm” , Folderlocation & “Elcom.rtf”, OverwriteExisting 

Being that RTF will show a HTML format this is any easy fix, all you have to do with this is change the
file name which we set in the begining of the script. So for example I would change “Elcom.htm” to
“MyCompany.htm”

  Here is the complete 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

' Additions added on 20 Nov 08 - Tested on Office 07 and Vista 
'====================  
 
'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.htm" , Folderlocation & "Elcom.rtf", OverwriteExisting
 
' ===========================
' 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