VBS Current User

2013-05-25

Il seguente script riporta l’utente corrente che sta eseguendo lo script.

 Set objSysInfo = Createobject("ADSystemInfo")
 Wscript.Echo "DN of current user: " & objSysInfo.UserName & vbCrLf & _
              "DN Of Name Computer: " & objSysInfo.ComputerName & vbCrLf 

 Dim strUser 
 strUser = Split(objSysInfo.UserName, ",")

 Dim strComputer
 strComputer = Split(objSysInfo.ComputerName, ",")

 Wscript.Echo "Current user: " & Mid(strUser(0),4,Len(strUser(0))) & vbCrLf & _
              "Name Computer: " & Mid(strComputer(0),4,Len(strComputer(0))) & vbCrLf