Office Software Thread, Change Office Username at logon? in Technical; Hello all,
I'm looking for a way, probably via a script. to set the office user name to match the ...
26th September 2013, 02:39 PM #1
Change Office Username at logon?
I'm looking for a way, probably via a script. to set the office user name to match the users network name at logon.
all our pupils are on mandatory profiles so the username field is just a generic SchoolUser for all of them.
any suggestions on this would be much appreciated.
IDG Tech News
26th September 2013, 02:58 PM #2
Microsoft Office 2010 stores this info in the registry:
The entries are: UserInitials and UserName. In theory you could write a script to populate these entries with the user logging on.
Thanks to Michael from:
Chris_Jones (26th September 2013)
26th September 2013, 03:22 PM #3
In theory, but I don't know much scripting! any suggestions?
26th September 2013, 03:36 PM #4
There are some scripting gurus on this forum, I'm sure someone can knock up some code together. Any takers?
26th September 2013, 03:48 PM #5
On error Resume next
Set objWord = CreateObject("Word.Application")
objWord.UserName = objUser.givenName & " " & objUser.SN
objWord.UserInitials = Left(objUser.givenName, 1) & Left(objUser.SN, 1)
27th September 2013, 09:31 AM #6
I presume that is vb script?
could you give a bit of explanation on what it does, as when I run it, it doesn't seem to change the username in office.
1st October 2013, 05:30 PM #7
It's a vbscript, yes. First problem is I missed off 2 lines that should have happened previously
Add these 2 lines to the start:
Set ADSysInfo = CreateObject("ADSystemInfo") -- creates an object to get info about the current user
Set objUser = GetObject("LDAP://" & ADSysInfo.UserName) -- gets their user object from their username
On error Resume next -- ignores errors, probably best to remove that line whilst debugging
Set objWord = CreateObject("Word.Application") -- load MS Word for scripting
objWord.UserName = objUser.givenName & " " & objUser.SN -- objUser is a previously defined object, I'll get back to that
objWord.UserInitials = Left(objUser.givenName, 1) & Left(objUser.SN, 1) -- this takes the first letter of givenname and surname and makes initials from them
objWord.Quit -- close MS word for scripting.
Hey, Scripting Guy!: Who Are You?
Thanks to mavhc from:
Chris_Jones (2nd October 2013)
2nd October 2013, 09:40 AM #8
Just tested that and it seems to work fine for our users.
By ctbjs in forum How do you do....it?
Last Post: 4th April 2007, 02:11 PM
By richard in forum Wireless Networks
Last Post: 4th January 2007, 10:14 AM
By Michael in forum Windows
Last Post: 30th March 2006, 03:33 PM
Last Post: 7th December 2005, 11:20 AM
By browolf in forum Windows
Last Post: 18th October 2005, 05:26 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread