一键获取软硬件配置及管理员组
作者:网络转载 发布时间:[ 2014/10/8 15:27:53 ] 推荐标签:软件测试管理 配置管理
作为公司的IT运维,经常要面对集团各种名头的稽查,对我们工作量造成相当大的提高。公司的IT政策不允许使用非法软件、USB口要关闭、电脑使用者不能有管理员权限等等。于是每一个底层的工作人员到晚围着用户的电脑跑,查找硬件配置,软件信息等,为了提高工作效率,于是写了以下批处理,减轻自己的工作负担。
功能说明:
1.扫描机器硬件配置
2.获取电脑的网络配置
3.扫描机器软件安装列表
4.查看Administrators组和Power Users组内的用户
5.电脑的USB存储端口开关情况
6.电脑的共享信息
7.扫描结果自动上传
扫描的?果以程序画面显示(重要?容)及转出以电脑名称命名的文本文件(详细?容)。并将此文本文件自动上传到共享文件夹中。
以下是批处理的代码:
@echo off
color 57
title HardSoft Viewer
mode con cols=67 lines=42
setlocal ENABLEDELAYEDEXPANSION
echo Prepare For View ...
del /f "%TEMP% emp.txt" 2>nul
dxdiag /t %TEMP% emp.txt
del /f "%COMPUTERNAME%.txt" 2>nul
echo Start Hardware Viewer ...
echo System Information: >>%COMPUTERNAME%.txt
:system
rem This must 30s
if EXIST "%TEMP% emp.txt" (
for /f "tokens=1,2,* delims=:" %%a in ('findstr /c:" Machine name:" /c:" Operating System:" /c:" System Model:" /c:" Processor:" /c:" Memory:" /c:" Card name:" /c:"Display Memory:" "%TEMP% emp.txt"') do (
set /a tee+=1
if !tee! == 1 echo Computer Name = %%b>>%COMPUTERNAME%.txt
if !tee! == 2 echo OS Type = %%b>>%COMPUTERNAME%.txt
if !tee! == 3 echo System Model = %%b>>%COMPUTERNAME%.txt
if !tee! == 4 echo CPU Model = %%b>>%COMPUTERNAME%.txt
if !tee! == 5 echo RAM Size = %%b>>%COMPUTERNAME%.txt
if !tee! == 6 echo.>>%COMPUTERNAME%.txt
if !tee! == 6 echo DisplayCard : >>%COMPUTERNAME%.txt
if !tee! == 6 echo Display Card = %%b>>%COMPUTERNAME%.txt
if !tee! == 7 echo DisplayMemory = %%b>>%COMPUTERNAME%.txt
) ) else (
ping /n 2 127.1>nul
goto system
)
set tee=0
echo.>>%COMPUTERNAME%.txt
echo Mother Board:>>%COMPUTERNAME%.txt
for /f "tokens=1,* delims==" %%a in ('wmic BASEBOARD get Manufacturer^,Product^,Version^,SerialNumber /value') do (
set /a tee+=1
if "!tee!" == "3" echo Manufacturer = %%b>>%COMPUTERNAME%.txt
if "!tee!" == "4" echo MotherBoard Model= %%b>>%COMPUTERNAME%.txt
)
set tee=0
)
echo.>>%COMPUTERNAME%.txt
echo Hard Disk: >>%COMPUTERNAME%.txt
for /f "skip=2 tokens=*" %%a in ('wmic DISKDRIVE get model ^,size /value') do (
echo. %%a>>%COMPUTERNAME%.txt
)
set tee=0
echo.>>%COMPUTERNAME%.txt
echo Network Card:>>%COMPUTERNAME%.txt
for /f "tokens=2* delims==:" %%a in ('ipconfig/all^|find /i "Description" ^| findstr /v "Microsoft" ^| findstr /v "Tunneling"') do (
set name=%%a
echo NetCard Model = %%a>>%COMPUTERNAME%.txt
)
for /f "tokens=2* delims==:" %%a in ('ipconfig/all^|find /i "Physical Address" ^| findstr /v "00-00-00-00"') do (
set name=%%a
echo MAC Address = %%a>>%COMPUTERNAME%.txt
)
for /f "tokens=2* delims==:" %%a in ('ipconfig/all^|find /i "描述" ^| findstr /v "Microsoft" ^| findstr /v "Tunneling"') do (
set name=%%a
echo NetCard Model = %%a>>%COMPUTERNAME%.txt
)
for /f "tokens=2* delims==:" %%a in ('ipconfig/all^|find /i "物理地址" ^| findstr /v "00-00-00-00"') do (
set name=%%a
echo MAC Address = %%a>>%COMPUTERNAME%.txt
)
ver|find /i "windows xp">nul 2>nul&&goto xp||goto win7
:xp
for /f "tokens=2* delims==:" %%a in ('ipconfig/all^|find /i "IP Address"') do (
set name=%%a
echo IP Address = %%a>>%COMPUTERNAME%.txt
)
echo Start Software Viewer For XP...
echo.>>%COMPUTERNAME%.txt
echo Software Information:>>%COMPUTERNAME%.txt
for /f "tokens=7 delims=" %%i in ('reg query "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall" ^| findstr /v "KB" 2^>nul') do (
for /f "skip=4 tokens=2*" %%a in ('reg query "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall\%%i" /v DisplayName 2^>nul' ) do (
echo %%b>>%COMPUTERNAME%.txt
)
)
for /f "tokens=2 delims=" %%x in ('reg query HKU') do (
for /f "tokens=8 delims=" %%a in ('reg query "HKU\%%xSoftwareMicrosoftWindowsCurrentVersionUninstall" 2^>nul') do (
for /f "skip=4 tokens=2*" %%i in ('reg query "HKU\%%xSoftwareMicrosoftWindowsCurrentVersionUninstall\%%a" /v "DisplayName" 2^>nul') do (
echo %%j>>%COMPUTERNAME%.txt
)
)
)
echo.>>%COMPUTERNAME%.txt
if exist %windir%system32CCMCcmExec.exe echo "SMS Client has been installed,please uninstall"
if exist %windir%system32CCMCcmExec.exe echo "SMS Client has been installed,please uninstall">>%COMPUTERNAME%.txt
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11