home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 42,486 of 42,547   
   Zaidy036 to Marion   
   Re: sysinfo.bat Outputs desired system i   
   27 Sep 25 21:19:23   
   
   XPost: alt.comp.os.windows-10, alt.comp.os.windows-11   
   From: Zaidy036@air.isp.spam   
      
   On 9/27/2025 3:44 PM, Marion wrote:   
   > sysinfo.bat   
   > Outputs desired system information to console & to a timestamped log file.   
   >   
   > This sysinfo.bat file outputs on my system everything I can think of   
   > that doesn't require elevation. What's missing that you would want?   
   >   
   >   @echo off   
   >   REM Purpose: Outputs system information   
   >   REM sysinfo.bat (version 1.0 20250922) output system information   
   >   REM sysinfo.bat (version 1.1 20250923) added msinfo32 wrapper   
   >   REM sysinfo.bat (version 1.2 20250924) added hotfixes & installed programs,   
   >   REM             firewall, winrm, secureboot, driver checks & write test   
   >   REM sysinfo.bat (version 1.3 20250925) added driverquery, secureboot   
   >   REM             virtualization checks & directory existence/writability   
   checks   
   >   REM sysinfo.bat (version 1.4 20250927) commented out WinRM checks   
   >   REM             as they required elevated permissions. Kept all else.   
   >   REM Usage: double-click, Win+R, or run from cmd.   
   >   REM Outputs timestamped log (e.g., C:\data\sys\log\sysinfo20   
   50927_123456.log)   
   >   REM Comment linelength limit ===============================   
   ===================   
   >   :: CONFIGURATION   
   >   set MSINFO_TIMEOUT=60   REM seconds to wait for msinfo32 before fallback   
   >   set TARGET_HTTP=example.com   
   >   set TARGET_PING=8.8.8.8   
   >   set "LOGDIR=C:\data\sys\log"   REM change if you prefer another directory   
   >   
   >   if "%1"=="__LOGGING__" goto :run_script   
   >   
   >   :: build timestamp (locale-safe for Windows 10)   
   >   for /f "tokens=1-4 delims=/ " %%a in ("%DATE%") do (   
   >     set DOW=%%a   
   >     set MM=%%b   
   >     set DD=%%c   
   >     set YYYY=%%d   
   >   )   
   >   for /f "tokens=1-3 delims=:." %%a in ("%TIME%") do (   
   >     set HH=%%a   
   >     set Min=%%b   
   >     set Sec=%%c   
   >   )   
   >   if "%HH:~0,1%"==" " set HH=0%HH:~1,1%   
   >   
   >   set LOGSTAMP=%YYYY%%MM%%DD%_%HH%%Min%%Sec%   
   >   set "LOGFILE=%LOGDIR%\sysinfo%LOGSTAMP%.log"   
   >   set "TMPTXT=%LOGDIR%\sysinfo%LOGSTAMP%.tmp"   
   >   
   >   :: Ensure required directories exist (creates LOGDIR and parents if needed)   
   >   if not exist "%LOGDIR%" (   
   >     md "%LOGDIR%" 2>nul   
   >     if errorlevel 1 echo WARNING: failed to create %LOGDIR%   
   >   )   
   >   
   >   :: Stream the second invocation live; Tee-Object writes an intermediate   
   text file   
   >   powershell -NoProfile -Command ^   
   >     " & { & cmd /c '\"%~f0\" __LOGGING__' 2>&1 | Tee-Object -FilePath   
   '%TMPTXT%' }"   
   >   
   >   :: Convert intermediate file to UTF-8 without BOM and remove temp   
   >   powershell -NoProfile -Command ^   
   >     " [System.IO.File]::WriteAllText('%LOGFILE%', (Get-Content -Raw   
   -LiteralPath '%TMPTXT%'), (New-Object System.Text.UTF8Encoding($false)));   
   Remove-Item -LiteralPath '%TMPTXT%' -ErrorAction SilentlyContinue"   
   >   
   >   echo.   
   >   echo Log created at %LOGFILE%   
   >   echo.   
   >   pause   
   >   exit /b   
   >   
   >   :run_script   
   >   echo [%DATE% %TIME%] sysinfo starting...   
   >   echo ==============================================   
   >   
   >   REM SECTION: invocation and basic info   
   >   echo script = %~f0   
   >   echo args = %*   
   >   echo COMSPEC = %COMSPEC%   
   >   echo current user = %USERNAME%\%USERDOMAIN%   
   >   echo user profile = %USERPROFILE%   
   >   echo local appdata = %LOCALAPPDATA%   
   >   echo temp = %TEMP%   
   >   echo   
   >   
   >   REM SECTION: ensure directories needed and test writability   
   >   REM Ensure the log directory exists and is writable by this user   
   >   echo -- Directory checks --   
   >   echo LOGDIR = %LOGDIR%   
   >   if exist "%LOGDIR%" ( echo LOGDIR exists ) else ( echo LOGDIR missing )   
   >   echo -- test write access to LOGDIR --   
   >   > "%LOGDIR%\._sysinfo_dir_test" echo OK 2>nul || echo write test failed   
   for %LOGDIR%   
   >   if exist "%LOGDIR%\._sysinfo_dir_test" del "%LOGDIR%\._sysinfo_dir_test"   
   >nul 2>nul   
   >   echo REM If the write test fails, logs may not be saved.   
   >   echo   
   >   
   >   REM SECTION: OS and system info   
   >   echo -- OS basic --   
   >   ver   
   >   systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Boot Time"   
   2>nul || systeminfo | findstr /I "OS" 2>nul   
   >   echo   
   >   
   >   REM SECTION: Powershell and path   
   >   echo -- PowerShell and execution policy --   
   >   where powershell 2>nul || echo powershell NOTFOUND   
   >   powershell -NoProfile -Command "$PSVersionTable.PSVersion; G   
   t-ExecutionPolicy -List" 2>nul || echo PowerShell info not available   
   >   echo   
   >   
   >   REM SECTION: environment and PATH   
   >   echo -- Environment variables --   
   >   echo PATH = %PATH%   
   >   echo PROGRAMFILES = %PROGRAMFILES%   
   >   echo PROGRAMFILES(X86) = %PROGRAMFILES(X86)%   
   >   echo PROGRAMDATA = %PROGRAMDATA%   
   >   echo TEMP = %TEMP%   
   >   echo   
   >   
   >   REM SECTION: filesystem and free space   
   >   echo -- Filesystem free space --   
   >   wmic logicaldisk get name,freespace,filesystem 2>nul   
   >   echo   
   >   
   >   REM SECTION: code page and locale   
   >   echo -- Code page and locale --   
   >   chcp   
   >   powershell -NoProfile -Command "[System.Globalization.Cultur   
   Info]::InstalledUICulture.DisplayName" 2>nul   
   >   echo   
   >   
   >   REM SECTION: networking basics   
   >   echo -- Networking: adapters, routes, listeners --   
   >   ipconfig /all   
   >   echo ------------------------   
   >   route print   
   >   echo ------------------------   
   >   netstat -ano   
   >   echo ------------------------   
   >   echo -- DNS/HTTP check --   
   >   nslookup %TARGET_HTTP%   
   >   echo ------------------------   
   >   ping -n 4 %TARGET_PING%   
   >   echo   
   >   
   >   REM SECTION: proxy and WinHTTP settings   
   >   echo -- Proxy and WinHTTP --   
   >   reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet   
   Settings" /v ProxyEnable 2>nul   
   >   reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet   
   Settings" /v ProxyServer 2>nul   
   >   reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet   
   Settings" /v AutoConfigURL 2>nul   
   >   reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet   
   Settings" /v AutoDetect 2>nul   
   >   echo netsh winhttp show proxy   
   >   netsh winhttp show proxy   
   >   echo   
   >   
   >   REM SECTION: installed tools and versions   
   >   echo -- Installed tools (where/versions if present) --   
   >   where curl 2>nul || echo curl NOTFOUND   
   >   where git 2>nul || echo git NOTFOUND   
   >   where python 2>nul || echo python NOTFOUND   
   >   where node 2>nul || echo node NOTFOUND   
   >   where gvim 2>nul || echo gvim NOTFOUND   
   >   echo   
   >   where curl 2>nul && curl -s --version 2>nul || echo curl version unknown   
   >   echo   
   >   
   >   REM SECTION: installed hotfixes and programs   
   >   echo -- Installed hotfixes (quick list) --   
   >   wmic qfe get HotFixID,InstalledOn 2>nul || echo qfe list not available   
   >   echo   
   >   echo -- Installed programs (registry uninstall keys, compact) --   
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca