A- A A+

User informatie dynamisch bijhouden in Microsoft Office

Ster inactiefSter inactiefSter inactiefSter inactiefSter inactief
 

Het script:

on error resume next

Dim objFSO, WshShell
const HKEY_LOCAL_MACHINE = &H80000002
const HKEY_CURRENT_USER  = &H80000001

strCompanyname = “<geef hier uw company naam in>”

strComputer = "."
Set objSysInfo = CreateObject("ADSystemInfo")
Set objCurrentUser = GetObject("LDAP://" & objSysInfo.UserName)
WScript.Echo objCurrentUser.givenName 
WScript.Echo objcurrentuser.lastname
wscript.Echo objcurrentuser.Fullname
wscript.Echo objcurrentuser.initials

Set WshShell = WScript.CreateObject("WScript.Shell")

MakeReg "UserInfo"
MakeReg "userInfoHide"

Sub MakeReg(strKey)
  WriteReg "HKEY_CURRENT_USER\Software\Microsoft\Office\Common\" & strKey & "\UserName",        strCompanyname, "REG_SZ"
  WriteReg "HKEY_CURRENT_USER\Software\Microsoft\Office\Common\" & strKey & "\CompanyName", strCompanyname,  "REG_SZ"
  WriteReg "HKEY_CURRENT_USER\Software\Microsoft\Office\Common\" & strKey & "\UserInitials",       objcurrentuser.initials, "REG_SZ"
  WriteReg "HKEY_CURRENT_USER\Software\Microsoft\Office\Common\" & strKey & "\UserName",        objcurrentuser.Fullname, "REG_SZ"
  WriteReg "HKEY_CURRENT_USER\Software\Microsoft\Office\Common\" & strKey & "\UserInfohide",     "Generalhide", "REG_SZ"
End Sub

Sub WriteReg(strKey, strValue, strType)
  WshShell.RegWrite strKey, strValue, strType   
End Sub

wscript.Echo "Klaar"