获取AD域用户登入信息
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取AD域用户登入信息相关的知识,希望对你有一定的参考价值。
获取AD用户登入信息
详细记录AD域用户登入过哪些终端电脑
1:
Dim con
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
UserName = objUser.sAMAccountName
displayName = objUser.displayName
telephone = objUser.telephoneNumber
Set WshNetwork = WScript.CreateObject("WScript.Network")
ComputerID = WshNetwork.ComputerName
Set objArgs = WScript. Arguments
connStr = "driver={sql server};Server=" + objArgs(0) +";Database="+objArgs(1)+";uid="+objArgs(2)+"pwd="+objArgs(3)+";"
set con = wscript.CreateObject("ADODB.Connection")
con.Open connStr
command = "delete from switch_UserLogin where ComputerID = ‘" ?+ ComputerID + ?"‘ and UserName = ‘" + UserName + "‘"
con.Execute(command)
command = "insert into switch_UserLogin (UserName,displayName,Telephone,ComputerID) values (‘"
command = command + UserName + "‘,‘" + displayName ?+ "‘,‘" ?+ telephone + "‘,‘" + ComputerID +"‘)"
con.Execute(command)
con.Close()
2:脚本运行实例
? ? ?wscript.exe domainserverNETLOGONgetUserInfo.vbs ip db user pw
3:通过AD域服务器发布用户登入脚本
??
以上是关于获取AD域用户登入信息的主要内容,如果未能解决你的问题,请参考以下文章