A execução:_________________________________
1 - Abra o bloco de notas
2 - Copie e cole o código abaixo:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objShell = CreateObject("Wscript.Shell")
Set objNet = CreateObject("WScript.Network")
Set objArgs = WScript.Arguments
Dim arrComputers()
If objArgs.Unnamed.Length > 0 Then
Dim i
i = 0
While i < objArgs.Unnamed.Length
ReDim Preserve arrComputers(i)
arrComputers(i) = objArgs.Unnamed.Item(i)
i = i + 1
Wend
Else
ReDim arrComputers(0)
arrComputers(0) = objNet.ComputerName
End If
Dim strLogPath
If objArgs.Named.Length > 0 Then
strLogPath = objArgs.Named.Item("path")
Else
strLogPath = ""
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each strComputer In arrComputers
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("Select * FROM Win32_Product",,48)
If Err.Number <> 0 Then
strComputer
Else
On Error Goto 0
Dim currentDate
currentDate = Date
Dim currentTime
currentTime = Time
Set objLogFile = objFSO.OpenTextFile(_
strLogPath & _
strComputer & _
"_" & _
Year(currentDate) & _
"-" & _
Month(currentDate) & _
"-" & _
Day(currentDate) & _
"-" & _
Hour(currentTime) & _
"-" & _
Minute(currentTime) & _
"-" & _
Second(currentTime) & _
"_" & _
"log.csv", ForWriting, True)
objLogFile.WriteLine _
"computer" & _
vbTab & _
"application" & _
vbTab & _
"vendor" & _
vbTab & _
"version"
For Each objItem In colItems
objLogFile.WriteLine _
strComputer & vbTab & _
objItem.Name & vbTab & _
objItem.Vendor & vbTab & _
objItem.Version
Next
objLogFile.Close
End If
Next
WScript.Quit(0)
Set objShell = CreateObject("Wscript.Shell")
Set objNet = CreateObject("WScript.Network")
Set objArgs = WScript.Arguments
Dim arrComputers()
If objArgs.Unnamed.Length > 0 Then
Dim i
i = 0
While i < objArgs.Unnamed.Length
ReDim Preserve arrComputers(i)
arrComputers(i) = objArgs.Unnamed.Item(i)
i = i + 1
Wend
Else
ReDim arrComputers(0)
arrComputers(0) = objNet.ComputerName
End If
Dim strLogPath
If objArgs.Named.Length > 0 Then
strLogPath = objArgs.Named.Item("path")
Else
strLogPath = ""
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each strComputer In arrComputers
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("Select * FROM Win32_Product",,48)
If Err.Number <> 0 Then
strComputer
Else
On Error Goto 0
Dim currentDate
currentDate = Date
Dim currentTime
currentTime = Time
Set objLogFile = objFSO.OpenTextFile(_
strLogPath & _
strComputer & _
"_" & _
Year(currentDate) & _
"-" & _
Month(currentDate) & _
"-" & _
Day(currentDate) & _
"-" & _
Hour(currentTime) & _
"-" & _
Minute(currentTime) & _
"-" & _
Second(currentTime) & _
"_" & _
"log.csv", ForWriting, True)
objLogFile.WriteLine _
"computer" & _
vbTab & _
"application" & _
vbTab & _
"vendor" & _
vbTab & _
"version"
For Each objItem In colItems
objLogFile.WriteLine _
strComputer & vbTab & _
objItem.Name & vbTab & _
objItem.Vendor & vbTab & _
objItem.Version
Next
objLogFile.Close
End If
Next
WScript.Quit(0)
3 - Salve o arquivo com o nome lista_prog.vbs na area de trabalho OBS.: Não esqueça de colocar o .vbs
4 - Clique sobre o ícone com o nome lista_prog
OBS.: A lista será salva no mesmo lugar que o script com o nome da maquina no formato csv, use o Excel para visualizar ou o bloco de notas mesmo.
Fonte: https://gist.github.com/glesica/1340333
OBS.: A lista será salva no mesmo lugar que o script com o nome da maquina no formato csv, use o Excel para visualizar ou o bloco de notas mesmo.
Fonte: https://gist.github.com/glesica/1340333
Nenhum comentário:
Postar um comentário