User Tools

Site Tools


batch:getsysteminfo

This is an old revision of the document!


GetSystemInfo

Work in progress …

SystemInfo.bat
@echo off
set logfile="X:\Systeminfo\sysinfo_%Username%.txt"
cls
echo GET System Information
echo GSolone 2013 (20130315-rev4)
echo.
echo NON CHIUDERE QUESTA FINESTRA.
echo.
systeminfo.exe >%logfile%
echo. >>%logfile%
echo. >>%logfile%
echo Utente connesso al sistema attualmente: %username% >>%logfile%
echo Dettaglio occupazione profilo su disco: >>%logfile%
du -accepteula -q "%userprofile%" >>%logfile%
del du.exe
:end
SystemInfo.bat
@echo off
set logfile="%Userprofile%\Desktop\Informazioni_Sistema.txt"
set alert=mario@rossi.it
set Sender="SystemInfo <root@systeminfo.local>"
cls
echo GET System Information
echo GSolone 2013 (20130315-rev3)
echo.
echo NON CHIUDERE QUESTA FINESTRA.
echo.
systeminfo.exe >%logfile%
echo. >>%logfile%
echo. >>%logfile%
echo Utente connesso al sistema attualmente: %username% >>%logfile%
echo Dettaglio occupazione profilo su disco: >>%logfile%
du -accepteula -q "%userprofile%" >>%logfile%
echo.
echo Analisi terminata, invio i risultati ...
cscript sendmail.vbs //B %Sender% %alert% "Configurazione di sistema %COMPUTERNAME%"
del %logfile%
del du.exe
del sendmail.vbs
:end
sendmail.vbs
' SENDMAIL (BODY TEXT FROM A TXT FILE) GSolone 20130315 rev0
' Based on SendMail GSolone 20121122 rev0
' Utilizzo: set delle variabili da script command per:
'				%sender% 		-mittente
'				%alert% 		-destinatario o destinatari
'				%COMPUTERNAME%	-hostname della macchina da variabile d'ambiente (vale via DOS, non VBS)
'
' Esecuzione del sendmail da script: cscript sendmail.vbs //B %Sender% %alert% "OCS agent problem on %COMPUTERNAME% (domain.tld)"
 
Set objNTInfo = CreateObject("WinNTSystemInfo")
Set objMessage = CreateObject("CDO.Message") 
Set objFSO = CreateObject("scripting.filesystemobject")
Set objArgs = WScript.Arguments
 
'Leggo dalla %UserProfile%\Desktop il file generato dal batch
Dim objShell : Set objShell = CreateObject("WScript.Shell")
Dim USER_PROFILE : USER_PROFILE = objShell.ExpandEnvironmentStrings("%UserProfile%")
Set objFile = objFSO.OpenTextFile(USER_PROFILE & "\Desktop\Informazioni_Sistema.txt", 1, False, 0)
strFile = objFile.ReadAll
 
objMessage.From = objArgs(0)
objMessage.To = objArgs(1)
objMessage.Subject = objArgs(2)
objMessage.TextBody = strFile
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.domain.local"
objMessage.Configuration.Fields.Update
objMessage.Send
batch/getsysteminfo.1363864178.txt.gz · Last modified: 2013/03/21 12:09 by gfsadministrator