one thing we noticed in our install of microsoft office 2007 on our terminal servers was initially the user names and company name were not set correctly.
this didn’t seem like that big of a deal to me at first, but then i saw the value of this user name. if multiple users have access to the same shared folder and two people are trying to access the same file, the second user trying to modify the file with be told that they can only have read-only access because its being used by “user name”. so, in our case, initially everyone’s user name was set to our administrators name.
obviously the user can call us and ask “who is editing the file?” and we can find out, but fixing this keeps us from getting one more call and easier on the user, so i wrote a script that would set it at login.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
' office_2007_set_username.vbs ' ' This script sets the username and company name correctly for Office products. ' Written because all users using Terminal Services version of office were showing ' the same user name, which made it hard to track down locks on files. ' Option Explicit Dim objShell, objNetwork Dim strUserName, strCompanyName Dim strNameRegKey, strCompanyRegKey Set objShell = CreateObject( "WScript.Shell" ) Set objNetwork = CreateObject("Wscript.Network") ' Set your user string and company name strUserName = objNetwork.UserName strCompanyName = "Your Company Name" ' Registry key locations for user name and company name strNameRegKey = "HKCU\Software\Microsoft\Office\Common\UserInfo\UserName" strCompanyRegKey = "HKCU\Software\Microsoft\Office\Common\UserInfo\CompanyName" On Error Resume Next ' If company name doesn't match the strCompanyName, change it If objShell.RegRead(strCompanyRegKey) <> strCompanyName Then objShell.RegWrite strCompanyRegKey, strCompanyName, "REG_SZ" End If ' If the user's name in office doesn't match their AD user name, change it If objShell.RegRead(strNameRegKey) <> strUserName Then objShell.RegWrite strNameRegKey, strUserName, "REG_SZ" End If