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


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


Sep 11 2008

Vista Built-in Screen Shot tool

So today I was just briefly looking through start > accessories, and I came across something called ’snipping Tool’, this tool is one of those screen shot tool where you can quickly select the area you need to screen shot, whilst I work in remote desktops regularly and screen shots in this will give you the active window of your remote desktops, server names and all that jazz, rather then the active session, or even active window within that session. this little tool I can see is going to save me time that’s for sure.

ok ok so I am little slow on find it, it only took me a year or so….

- yes I know there a billion free ware apps out there that do this, but when it comes to installing items I am very picky I like to keep a clean a OS.


May 28 2008

VISTA: Remote Registry off by default

Just a quick one today, as you probably have worked out the remote registry is turned off by default within windows vista making Sys Admin job’s a little harder to install third party applications through a central location.

I was unable to find a script that would start the service and then create the service as automatic.

whilst the starting the service is easy enough, I wanted the service to be automatic, so that way we only have to run the script on all VISTA machines just once, there is no point running it every time on boot up when  we can avoid slowing the system down a little.

Here is the script (.BAT) it will set the service to automatic (on XP and VISTA)

 

reg import "\\DOMAINCONTROLLER NAME HERE\SYSVOL\DOMAIN\scripts\remotereg.reg"
net start "remote registry"

NOTE: I did not use the delay start because my Group Policy applies to both XP and Vista, this would cause a conflict as the delay start is not an option in XP, I would recommend the delayed start method if you have isolated just your VISTA machines in a group policy

 

Above you can see it is calling a .reg file this is the contents of the reg, copy and save it as a .reg file also

Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RemoteRegistry]
"Start"=dword:00000002
 

May 19 2008

Vista Activation: 0×8007232B – DNS name does not exist

If you have installed a Volume licence version on Vista business / Enterprise, you may get the below error message when trying to active the product

clip_image002

a pretty useless error message, but it does have a very easy fix, simply go to computer and then ‘change Product Key’ enter in the same product key that you had previously used for the VISTA installation.

That’s it it should activate within seconds.


May 8 2008

Vista / 2008: Unable to move file into Command Line Window

I am sure anyone that uses command line has at some point pulled a file from a active window into a command line, this way you don’t have to type the path, and lets face it some of those paths are horrendously long.

If you have Vista or 2008 Server you will have noted that you no longer have this function, and from doming some reading on this some time ago there is quite an up roar about it, rightfully so I say!

I and many others I know use this functionality on a very regular basis. I was looking high and low  and just could not find anything, however today I stumbled across some way to do this, not exactly the same but its still a huge help

When you right click on a folder you get the following:

 

image

 

BUT hold down SHIFT and then right click on the folder

image

Notice the 2 new items within the list:

‘Open Command Window Here’

Which will do this:

image

And

‘Copy as Path’

You wont see but when pressing paste or CTRL + V it will reveal the path, which in my case is:

“C:\Drivers\audio”

 

the open command line is a big help, but this can only be used at the folder level if you try and do this on the file (eg .exe .bat .vbs) you will no longer have this option, however you will have the copy as path, this can be chosen and then paste this into your command line and then enter…

 

No more typing the full path again.


May 3 2008

TIP: Speed Up Vista

Within Vista if your running your PC on a SATA drive, which lets face it most modern everyday PC’s use SATA drive including Notebooks.

Microsoft have an option called ‘Advanced Performance ‘ that allows us write more to the cache, which in turn will speed up the performance of the PC, however the downside to this is  that any power loss leaves the potential for data loss or disk corruption.

So for Notebook users, so long as your battery works (and you don’t let you battery go dead) use it, it is reasonably safe, for desktop users use it with caution, and maybe consider a UPS, the cost of a UPS these days is minimal.

Anyway I suppose you all want to know where and how to turn it on.

right click ‘Computer’

Choose ‘Properties‘ you should see the below screen

image

At the top left of this screen you will see ‘Device Manager’  click this.

You will then see the below, Once you have it open locate your ‘Disk Drives’

image

find your Disk you wish to speed up, and then right click on it choose ‘Properties

Click on the ‘Policies’ tab and then tick the 2 options as per below.

image

Done

 

:)