Archive for julho \13\UTC 2010|Monthly archive page

Monitorando LOGON com vbs

Eu uso aqui no trabalho e funciona muito bem! Um amigo usou o mesmo script e colocou como script de logon e logoff.
Nas configurações de segurança de pastas concedo permissão ao usuário para somente alterar, e desmarco a opção excluir!

‘Inventario basico da Estação de Trabalho
‘Romeu –

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\”& strComputer & “\root\cimv2”)

Set colSettings = objWMIService.ExecQuery (“Select * from Win32_ComputerSystem”)
Set colBIOS = objWMIService.ExecQuery (“Select * from Win32_BIOS”)
Set colDisks = objWMIService.ExecQuery (“Select * from Win32_LogicalDisk”)

Set IPConfigSet = objWMIService.ExecQuery (“Select IPAddress from Win32_NetworkAdapterConfiguration “)

Set oNetwork = CreateObject(“WScript.Network”)

‘Basta alterar o caminho UNC para onde vc queira armazenar os logs.
UNC = “\\caminho\invent$\”

strComputer = oNetwork.ComputerName
struser = oNetwork.UserName
systime = Now()
srtDay = cstr(day(systime))
strMonth = cstr(month(systime))
strYear = cstr(year(systime))
strTime = cstr(Time())
Const ForAppending = 8

For Each objComputer in colSettings
strManufac = objComputer.Manufacturer
strModel = objComputer.Model
strMemo = objComputer.TotalPhysicalMemory/1024000
Next

For each objBIOS in colBIOS
strSerial = objBIOS.SerialNumber
strBVersion = objBIOS.Version
Next

For Each strIPConfig in IPConfigSet
If Not IsNull(strIPConfig.IPAddress) Then
For i=LBound(strIPConfig.IPAddress) _
to UBound(strIPConfig.IPAddress)
‘WScript.Echo strIPConfig.IPAddress(i) &” – i=”& i
strIP0 = strIPConfig.IPAddress(0)
‘strIP1 = strIPConfig.IPAddress(1)

Next
End If
Next

For each objDisk in colDisks
strDiskTotal = objDisk.Size/1024
strDiskFree = objDisk.FreeSpace/1024
Next

Set fso = CreateObject(“Scripting.FileSystemObject”)

StrNew = UNC & strIP0 &”.log”

set sf=fso.OpenTextFile (StrNew, ForAppending, True)
sf.writeline “NOME DO HOST =” & strComputer & “; UserID =”& strUser &”; Date =”& srtDay &”-“& strMonth &”-“& strYear &”; Time =”& strTime & _
“; Manufacturer =” & strManufac & “; Model =”& strModel &”; Serial Number =”& strSerial & “; BIOS Version =:”& strBVersion & _
“; Memoria Fisica Total =”& strMemo &”; MAC ADDRESS =”& strMac & “; IP ADDRESS =”& strIP0 & _
“; Disk Size =”& strDiskTotal &”; Free Space =”& strDiskFree

Anúncios