Logon Scripts

inventory.bat
@ECHO OFF
COLOR 1A

:: output directory -----------------
set i="\\your.domain.com\SysVol\your.domain.com\Policies\{ADC5C565-A2FB-4A17-B908-1B3C3BE14ACC}\Machine\Scripts\Startup\_INVENTORY\"
set report_file="\\your.domain.com\SysVol\your.domain.com\Policies\{ADC5C565-A2FB-4A17-B908-1B3C3BE14ACC}\Machine\Scripts\Startup\report.txt"
:: ----------------------------------

SET ISODATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%
SET ISOTIME=%time:~0,2%.%time:~3,2%.%time:~6,2%

echo .... ComputerName=%COMPUTERNAME%, UserName=%USERNAME%

echo ..getting ip address
::for /f "skip=1 tokens=2 delims=[]" %%* in ('ping.exe -4 -n 1 %COMPUTERNAME%') do (set "IP=%%*" & goto:exitFor1)
for /F "tokens=2 delims= " %%i in ('netsh interface ip show address ^| find "IP" ^| find "192.168." ^| findstr /v "\.1\>"') do set ip=%%~i
:::exitFor1

echo .... found ip=%IP%

echo ..making dirs
set p=%IP%_%COMPUTERNAME%_%ISODATE%_%ISOTIME%
mkdir "%i%"
mkdir "%i%\%p%"

echo ..extracting software list (from uninstall)
If Exist %temp%\_temp2.txt Del %temp%\_temp2.txt
regedit /e %temp%\_temp2.txt "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
find "DisplayName" %temp%\_temp2.txt > %temp%\_temp3.txt
for /f "tokens=2 delims==" %%a in (%temp%\_temp3.txt) do echo %%~a >>%temp%\_temp4.txt
del %temp%\_temp2.txt
del %temp%\_temp3.txt
move /y %temp%\_temp4.txt "%i%\%p%\software.txt"

::echo ..exporting full software registry
::regedit -ea %temp%\_temp.reg "HKEY_LOCAL_MACHINE\SOFTWARE"
::move /y %temp%\_temp.reg "%i%\%p%\%COMPUTERNAME%_HKLM_SOFTWARE_FULL.reg"

echo ..saving ipconfig
ipconfig -all > "%i%\%p%\ipconfig.txt"

echo ..saving sysinfo
Systeminfo > "%i%\%p%\systeminfo.txt"

\\your.domain.com\SysVol\your.domain.com\Policies\{ADC5C565-A2FB-4A17-B908-1B3C3BE14ACC}\Machine\Scripts\Startup\AIDA64\AIDA64.exe /R "%i%\%p%\AIDA64" /CSV /AUDIT /SILENT /SAFE /LANGEN

echo ..DONE.. :o)
install-soft.bat
@Echo Off
:: ------------------------------------------------------------------------------------------------------------------------------
:: config
SET SOFT_CUR_VERSION="5.4"
:: ------------------------------------------------------------------------------------------------------------------------------
:: globals
set report_file="\\your.domain.com\SysVol\your.domain.com\Policies\{ADC5C565-A2FB-4A17-B908-1B3C3BE14ACC}\Machine\Scripts\Startup\report.txt"
SET ISODATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%
SET ISOTIME=%time:~0,2%.%time:~3,2%.%time:~6,2%
for /F "tokens=2 delims= " %%i in ('netsh interface ip show address ^| find "IP" ^| find "192.168." ^| findstr /v "\.1\>"') do set ip=%%~i
:: ------------------------------------------------------------------------------------------------------------------------------

echo %ISODATE% %ISOTIME% %IP% %COMPUTERNAME% - machine started >> %report_file%

IF EXIST "%SYSTEMROOT%\security\soft\version-%SOFT_CUR_VERSION%.txt" GOTO END

:: ------------------------------------------------------------------------------------------------------------------------------
:: SOFT installation
echo %ISODATE% %ISOTIME% %IP% %COMPUTERNAME% SOFT version %SOFT_CUR_VERSION% not found! Installing SOFT... >> %report_file%
\\your.domain.com\SysVol\your.domain.com\Policies\{ADC5C565-A2FB-4A17-B908-1B3C3BE14ACC}\Machine\Scripts\Startup\SOFT_AD_%SOFT_CUR_VERSION%.exe -y -gm2 -fm0
echo %ISODATE% %ISOTIME% %IP% %COMPUTERNAME% SOFT installation completed >> %report_file%
:: ------------------------------------------------------------------------------------------------------------------------------

:: ------------------------------------------------------------------------------------------------------------------------------
:: inventory
echo %ISODATE% %ISOTIME% %IP% %COMPUTERNAME% Starting inventory... >> %report_file%
CALL \\your.domain.com\SysVol\your.domain.com\Policies\{ADC5C565-A2FB-4A17-B908-1B3C3BE14ACC}\Machine\Scripts\Startup\invent.bat
echo %ISODATE% %ISOTIME% %IP% %COMPUTERNAME% Inventory DONE. >> %report_file%
:: ------------------------------------------------------------------------------------------------------------------------------

:END
Exit