@echo off
setlocal EnableDelayedExpansion
SETLOCAL ENABLEEXTENSIONS

 del %temp%\%COMPUTERNAME%.txt 2>nul
  
 echo __collecttime>>%temp%\%COMPUTERNAME%.txt
 echo %DATE% %TIME% >>%temp%\%COMPUTERNAME%.txt

 echo __computername>>%temp%\%COMPUTERNAME%.txt
 wmic computersystem get Name /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __username>>%temp%\%COMPUTERNAME%.txt
 set /P uname= "Utilizatorul logat este: %USERNAME%.	Daca este corect apasati ENTER, daca nu scrieti utilizatorul:	"
 IF NOT DEFINED uname (set uname=%USERNAME%)
 echo( %uname%>>%temp%\%COMPUTERNAME%.txt
 echo __userlevel>>%temp%\%COMPUTERNAME%.txt
 net session >nul 2>&1
    if %errorLevel% == 0 (
        echo Administrator>>%temp%\%COMPUTERNAME%.txt
    ) else (
        echo User>>%temp%\%COMPUTERNAME%.txt
    )
 REM net user "%USERNAME%" /domain |find "Membership">>%temp%\%COMPUTERNAME%.txt

 echo __computersystem>>%temp%\%COMPUTERNAME%.txt
 wmic computersystem list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __bios>>%temp%\%COMPUTERNAME%.txt
 wmic bios list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __baseboard>>%temp%\%COMPUTERNAME%.txt
 wmic baseboard list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __cpu>>%temp%\%COMPUTERNAME%.txt
 wmic cpu list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __memorychip>>%temp%\%COMPUTERNAME%.txt
 wmic memorychip list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __displayadaptor>>%temp%\%COMPUTERNAME%.txt
 wmic path win32_VideoController get name /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt

 echo __monitor>>%temp%\%COMPUTERNAME%.txt
 %~dp0MonitorInfoView.exe /scomma %~dp0monitor.txt /HideInactiveMonitors 1
 type %~dp0monitor.txt >>%temp%\%COMPUTERNAME%.txt
 del %~dp0monitor.txt

 echo __diskdrive>>%temp%\%COMPUTERNAME%.txt
 wmic diskdrive list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __logicaldisk>>%temp%\%COMPUTERNAME%.txt
 wmic logicaldisk list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt

 echo __nic>>%temp%\%COMPUTERNAME%.txt
 wmic nic list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __onboarddevice>>%temp%\%COMPUTERNAME%.txt
 wmic onboarddevice list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __printer>>%temp%\%COMPUTERNAME%.txt
 wmic printer list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt
 echo __sounddev>>%temp%\%COMPUTERNAME%.txt
 wmic sounddev list full /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt

 echo __os>>%temp%\%COMPUTERNAME%.txt
 wmic os get Version, Caption, CountryCode, CSName, Description, InstallDate, SerialNumber, ServicePackMajorVersion, WindowsDirectory  /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt

 echo __installedprograms>>%temp%\%COMPUTERNAME%.txt
 wmic product get Caption,InstallDate,Name,Vendor,Version /format:csv | find /v "">>%temp%\%COMPUTERNAME%.txt


 echo __teamviewer>>%temp%\%COMPUTERNAME%.txt
 REM copy  %~dp0monitor.ps1 %temp%\monitor.ps1
 REM powershell -NoProfile -ExecutionPolicy Bypass "& %~dp0teamviewerID.ps1">>%temp%\%COMPUTERNAME%.txt
 reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TeamViewer\ /v ClientID >>%temp%\%COMPUTERNAME%.txt


 echo open ftp://"inventar@zenos.ro":VBNinz51MuEm@itzen.ro:21> %temp%\uploadinventar.txt
 REM echo option batch continue%temp%\uploadinventar.txt
 echo option confirm off>> %temp%\uploadinventar.txt
 echo option batch abort>> %temp%\uploadinventar.txt
 echo cd icr>> %temp%\uploadinventar.txt
 echo lcd %temp%>> %temp%\uploadinventar.txt
 echo bin>> %temp%\uploadinventar.txt
 echo put "%COMPUTERNAME%.txt">> %temp%\uploadinventar.txt
 echo exit>> %temp%\uploadinventar.txt

 copy  %~dp0winscp.exe %temp%\winscp.exe
 "%temp%\winscp.exe" /console /script=%temp%\uploadinventar.txt  /log=%temp%\winscp.log

 del /f %temp%\winscp.exe 2>nul
 del /f %temp%\winscp.log 2>nul
 del /f %temp%\winscp.ini 2>nul

 del /f %temp%\%COMPUTERNAME%.txt 2>nul
 del /f %temp%\uploadinventar.txt 2>nul

 REM del "%~f0"

