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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| set objWshNet = CreateObject("Wscript.Network")
strCN = lcase(objWshNet.ComputerName)
strCU = lcase(objWshNet.UserName)
Dim objFS, objFile, append
append = 8
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
strfile = "\\path\" & strCN & "_access.log"
Set objLogFile = objFSO.OpenTextFile(strfile, append, True)
objLogFile.WriteLine (strCU & " on " & strCN & " " & Now())
objLogFile.Close
Set objWSHShell = CreateObject("Wscript.Shell")
'36 Msgbox "The application has started."
Set objWSHShell = CreateObject("Wscript.Shell")
' Msgbox "The application has started."
Set objADSysInfo = CreateObject("ADSystemInfo")
strUser = objADSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
'msgBox "You current object path is: " & strUser
strgivenName = objUser.Get("givenName")
strdisplayName = objUser.Get("displayName")
MsgBox " Bienvenue " & strdisplayName & " !"
strMyDC = "mydomain" & "/"
'strMyDC = My Domain Controller
Set objADSysInfo = CreateObject("ADSystemInfo")
strUser = objADSysInfo.UserName
Set objItem = GetObject("LDAP://" & strMyDC & strUser)
On Error Resume Next
'GetInfo
strStreetAddress = objItem.Get("streetAddress")
strPOBOX = objItem.Get("postOfficeBox")
strCity = objItem.Get("l")
strZIP = objItem.Get("postalCode")
strTelephoneNumber = objItem.Get("telephoneNumber")
strMobile = objItem.Get("mobile")
strTitle = objItem.Get("title")
'62 WriteInfo
Txt_Add.Value = strStreetAddress
'Txt_POBox.Value = strPOBOX
Txt_City.Value = strCity
Txt_ZIP.Value = strZIP
Txt_PhN.Value = strTelephoneNumber
Txt_Cell.Value = strMobile
Txt_Title.Value = strTitle
End Sub |
Partager