标签:creat where 脚本 cond exe min work 计算机 exec
1:在域管理服务器上,打开组策略Option Explicit
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")
computerName = WshNetwork.ComputerName
serverIP = Wscript.Arguments(0)
serverDB = Wscript.Arguments(1)
serverUSer = Wscript.Arguments(2)
serverPW = Wscript.Arguments(3)
CurrentTime=Year(Now)&"-"&Month(Now)&"-"&day(Now)&" "&Hour(Now)&":"&Minute(Now)&":"&Second(Now)
set con = wscript.CreateObject("ADODB.Connection")
ConStr = "driver={sql server};Server=" + serverIP + ";Database=" + serverDB + ";uid=" + serverUSer + ";pwd=" + serverPW +";"
con.Open ConStr
‘ 删 除在同一终端机上的登入记录,只保留最新登入记录
command = "delete from username where computername = ‘" + computername + "‘ and username = ‘" + userName + "‘"
con.Execute(command)
command = "insert into username (username,computername,logintime,displayName,telephone) values (‘"
command = command + userName + "‘,‘" + computerName + "‘,‘" + CurrentTime + "‘,‘" + displayName + "‘,‘" + telephone + "‘)"
con.Execute(command)
con.Close()
标签:creat where 脚本 cond exe min work 计算机 exec
原文地址:https://blog.51cto.com/13804335/2364345