REM ************************************************************************** REM REM Copyright (c) SAPIEN Technologies, Inc. All rights reserved REM This file is part of the PrimalScript 2007 Code Samples. REM REM File: SysPeek.bat REM REM Comments: REM USAGE- syspeek [computer] REM DESC- Build HTML page of system resource usage for specified computer. REM Default html filename is computernameInfo.htm and it is created in the same REM directory you run the script from. REM If you don't specify a computer, script will default to local host. REM Information gathered: REM pagefile REM memory REM logical drives REM services REM processes REM IMPORTANT NOTES- This script uses a command line version of WMI that is only available REM on Windows XP and 2003 platforms. Before you can run the script you must install WMIC. REM Open a command prompt and type 'WMIC' which will start the installation. When it is REM finished you will have an interactive prompt (wmic:root\cli>). Type 'exit'. You can now REM run this script. The computer you are querying doesn't need WMIC but it must be WMI-enabled. REM You must have appropriate credentials on the target computer. You can specify alternate REM credentials, but you will need to use the /USER and /PASSWORD global switches. Run REM wmic /? at a command prompt to see help screens. REM For more information, read the excellent article in the March 2002 issue of Windows & .NET REM Magazine by Ethan Wilansky (InstantDoc 23854). REM You can build your own format files (.xsl) if you understand XML. The files are REM found in %systemroot%\system32\wbem. I've used one of the default files for demonstration. REM REM Disclaimer: This source code is intended only as a supplement to REM SAPIEN Development Tools and/or on-line documentation. REM See these other materials for detailed information REM regarding SAPIEN code samples. REM REM THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY REM KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE REM IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A REM PARTICULAR PURPOSE. REM REM ************************************************************************** @echo off :Top ::script version used in output set zver=v1.9 if "%1"=="" goto :Local set zSrv=%1 goto :Main :Local set zSrv=%computername% :Main echo Getting system resource information for "%zSrv%" ::Define file for html output set zOutput=%zSrv%-Info.htm ::delete file if it already exists if exist %zOutput% del %zOutPut% >NUL ::delete error log if it previously exists if exist %zSrv%-Error.log del %zSrv%-Error.log >NUL ::build a shell html file. Not required but I wanted to try. echo ^ >> %zOutput% echo ^
>> %zOutput% echo ^%zSrv%^
>>%zOutput%
echo System Resources Information^