+ Post New Thread
Results 1 to 8 of 8
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 ...
  1. #1

    Join Date
    Jun 2007
    Location
    Rochdale
    Posts
    238
    Thank Post
    27
    Thanked 35 Times in 30 Posts
    Rep Power
    21

    Change Office Username at logon?

    Hello all,

    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.

    Cheers

  2. #2

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,308
    Thank Post
    242
    Thanked 1,589 Times in 1,266 Posts
    Rep Power
    344
    Microsoft Office 2010 stores this info in the registry:

    Code:
    HKCU\SOFTWARE\Microsoft\Office\Common\UserInfo
    The entries are: UserInitials and UserName. In theory you could write a script to populate these entries with the user logging on.

  3. Thanks to Michael from:

    Chris_Jones (26th September 2013)

  4. #3

    Join Date
    Jun 2007
    Location
    Rochdale
    Posts
    238
    Thank Post
    27
    Thanked 35 Times in 30 Posts
    Rep Power
    21
    In theory, but I don't know much scripting! any suggestions?

  5. #4

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,308
    Thank Post
    242
    Thanked 1,589 Times in 1,266 Posts
    Rep Power
    344
    There are some scripting gurus on this forum, I'm sure someone can knock up some code together. Any takers?

  6. #5

    Join Date
    Jan 2007
    Location
    Nottinghamshire
    Posts
    530
    Thank Post
    1
    Thanked 84 Times in 58 Posts
    Rep Power
    38
    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)
    objWord.Quit

  7. #6

    Join Date
    Jun 2007
    Location
    Rochdale
    Posts
    238
    Thank Post
    27
    Thanked 35 Times in 30 Posts
    Rep Power
    21
    mavhc,
    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.

    Cheers

  8. #7

    Join Date
    Jan 2007
    Location
    Nottinghamshire
    Posts
    530
    Thank Post
    1
    Thanked 84 Times in 58 Posts
    Rep Power
    38
    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?

  9. Thanks to mavhc from:

    Chris_Jones (2nd October 2013)

  10. #8

    Join Date
    Jun 2007
    Location
    Rochdale
    Posts
    238
    Thank Post
    27
    Thanked 35 Times in 30 Posts
    Rep Power
    21
    Just tested that and it seems to work fine for our users.

    Cheers!



SHARE:
+ Post New Thread

Similar Threads

  1. Black Screen at Logon
    By ctbjs in forum How do you do....it?
    Replies: 4
    Last Post: 4th April 2007, 02:11 PM
  2. Problem assigning printers at logon - SOLVED
    By richard in forum Wireless Networks
    Replies: 12
    Last Post: 4th January 2007, 10:14 AM
  3. Ctrl+Alt+Del at logon
    By Michael in forum Windows
    Replies: 6
    Last Post: 30th March 2006, 03:33 PM
  4. Replies: 5
    Last Post: 7th December 2005, 11:20 AM
  5. copying a file at logon
    By browolf in forum Windows
    Replies: 1
    Last Post: 18th October 2005, 05:26 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •