среда, 29 января 2014 г.

Скрипт для сбора некоторых данных при входе(выходе) в(из) AD:
(AD logon - habrahabr)

On Error Resume Next Dim adsinfo, ThisComp, oUser Set adsinfo = CreateObject("adsysteminfo") Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName) Set oUser = GetObject("LDAP://" & adsinfo.UserName) Thiscomp.put "description", "Logged on: " + oUser.cn + " " + CStr(Now)

ThisComp.Setinfo oUser.put "description", "Logged on: " + ThisComp.cn + " " + CStr(Now) oUser.Setinfo

(AD logoff - habrahabr)


On Error Resume Next Dim adsinfo, ThisComp, oUser Set adsinfo = CreateObject("adsysteminfo") Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName) Set oUser = GetObject("LDAP://" & adsinfo.UserName) Thiscomp.put "description", ">>Logged off: " + oUser.cn + " " + CStr(Now) ThisComp.Setinfo oUser.put "description", ">>Logged off: " + ThisComp.cn + " " + CStr(Now) oUser.Setinfo


Узнаем ip по vbs:


strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set IPConfigSet = objWMIService.ExecQuery _ ("Select * 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) WScript.Echo IPConfig.IPAddress(i) Next End If Next