Username in registry key

  • Thread starter Thread starter Sim
  • Start date Start date
S

Sim

I have installed and configured Office 2000 using a MST file on Citrix.

All working fine, except when users use Excel and add a comment it' appears
with my name, does any one which registry this is stored in to make the
necessary change.

Regards
 
For 2003 it's probably;
HKCU\Software\Microsoft\Office\11.0\Common\UserInfo

Can't verify this but look in;
HKCU\Software\Microsoft\Office\9.0\Common\UserInfo


--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I have installed and configured Office 2000 using a MST file on Citrix.
|
| All working fine, except when users use Excel and add a comment it'
appears
| with my name, does any one which registry this is stored in to make the
| necessary change.
|
| Regards
|
|
 
The information contained in the registry is in binary, would I have to
convert this and enter the correct username?

Thanks
 
Sim said:
The information contained in the registry is in binary, would I have to
convert this and enter the correct username?
Hi

With a VBScript:

'--------------------8<----------------------
Const HKCU = &H80000001

sComputer = "."

' Office username to be written to registry
sUsername = "torgeir"

aUsername = ToByteArray(sUsername)

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\default:StdRegProv")

sKeyPath = "SOFTWARE\MICROSOFT\OFFICE\9.0\COMMON\USERINFO\"
sValueName = "UserName"

iRC = oReg.SetBinaryValue(HKCU, sKeyPath, sValueName, aUsername)

If iRC <> 0 Then
'An error occurred
WScript.Echo "Error, return code: " & iRC
WScript.Quit
End If


Function ToByteArray(ByVal sString)

ReDim aBytes(Len(sString) * 2 + 1)

iIndex = -1
For iPos = 1 To Len(sString)
iIndex = iIndex + 1
aBytes(iIndex) = Asc(Mid(sString, iPos, 1))
' add a 0 after each letter
iIndex = iIndex + 1
aBytes(iIndex) = 0
Next

' add two closing 0's
iIndex = iIndex + 1
aBytes(iIndex) = 0
iIndex = iIndex + 1
aBytes(iIndex) = 0

ToByteArray = aBytes
End Function
'--------------------8<----------------------
 
Well.............. there you have it.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Sim wrote:
|
| > The information contained in the registry is in binary, would I have to
| > convert this and enter the correct username?
| Hi
|
| With a VBScript:
|
| '--------------------8<----------------------
| Const HKCU = &H80000001
|
| sComputer = "."
|
| ' Office username to be written to registry
| sUsername = "torgeir"
|
| aUsername = ToByteArray(sUsername)
|
| Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
| & sComputer & "\root\default:StdRegProv")
|
| sKeyPath = "SOFTWARE\MICROSOFT\OFFICE\9.0\COMMON\USERINFO\"
| sValueName = "UserName"
|
| iRC = oReg.SetBinaryValue(HKCU, sKeyPath, sValueName, aUsername)
|
| If iRC <> 0 Then
| 'An error occurred
| WScript.Echo "Error, return code: " & iRC
| WScript.Quit
| End If
|
|
| Function ToByteArray(ByVal sString)
|
| ReDim aBytes(Len(sString) * 2 + 1)
|
| iIndex = -1
| For iPos = 1 To Len(sString)
| iIndex = iIndex + 1
| aBytes(iIndex) = Asc(Mid(sString, iPos, 1))
| ' add a 0 after each letter
| iIndex = iIndex + 1
| aBytes(iIndex) = 0
| Next
|
| ' add two closing 0's
| iIndex = iIndex + 1
| aBytes(iIndex) = 0
| iIndex = iIndex + 1
| aBytes(iIndex) = 0
|
| ToByteArray = aBytes
| End Function
| '--------------------8<----------------------
|
|
| --
| torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
| Administration scripting examples and an ONLINE version of
| the 1328 page Scripting Guide:
| http://www.microsoft.com/technet/scriptcenter/default.mspx
 
Back
Top