一键获取软硬件配置及管理员组

作为公司的IT运维,经常要面对集团各种名头的稽查,对我们 工作量造成相当大的提高 。公司的IT政策不允许使用非法软件、USB口要关闭、电脑使用者不能有管理员权限等等 。于是每一个最底层的工作人员一天到晚围着用户的电脑跑,查找硬件配置,软件信息等,为了提高工作效率,于是就写了以下批处理,减轻自己的工作负担 。
功能说明:
1.扫描机器硬件配置
2.获取电脑的网络配置
3.扫描机器软件安装列表
4.查看组和Power Users组内的用户
5.电脑的USB存储端口开关情况
6.电脑的共享信息
7.扫描结果自动上传
扫描的結果以程序画面显示(重要內容)及转出以电脑名称命名的文本文件(详细內容) 。并将此文本文件自动上传到共享文件夹中 。
以下是批处理的代码:
@echo off
color 57
title
mode con cols=67 lines=42
ON
echoFor View ...
del /f "%TEMP%\temp.txt" 2>nul
/t %TEMP%\temp.txt
del /f "%%.txt" 2>nul
echo Start...
echo: >>%%.txt
:
rem This must 30s
if EXIST "%TEMP%\temp.txt" (
for /f "=1,2,* =:" %%a in (' /c:"name:" /c:":" /c:"Model:" /c:" :" /c:" :" /c:" Card name:" /c:" :" "%TEMP%\temp.txt"') do (
set /a tee+=1
if !tee! == 1 echoName = %%b>>%%.txt
if !tee! == 2 echoOSType = %%b>>%%.txt
if !tee! == 3 echoModel = %%b>>%%.txt
if !tee! == 4 echoCPUModel = %%b>>%%.txt
if !tee! == 5 echoRAMSize = %%b>>%%.txt
if !tee! == 6 echo.>>%%.txt
if !tee! == 6 echo: >>%%.txt
if !tee! == 6 echoCard = %%b>>%%.txt
if !tee! == 7 echo= %%b>>%%.txt
)) else (
ping /n 2 127.1>nul
goto
set tee=0
echo.>>%%.txt
echoBoard:>>%%.txt
for /f "=1,* ==" %%a in ('wmicget ^,^,^, /value') do (
set /a tee+=1
if "!tee!" == "3" echo= %%b>>%%.txt
if "!tee!" == "4" echoModel= %%b>>%%.txt
set tee=0
echo.>>%%.txt
echo Hard Disk: >>%%.txt
for /f "skip=2 =*" %%a in ('wmicget model ^,size /value') do (
echo.%%a>>%%.txt
set tee=0
echo.>>%%.txt
echoCard:>>%%.txt
for /f "=2* ==:" %%a in ('/all^|find /i "" ^|/v "" ^|/v ""') do (
set name=%%a
echoModel = %%a>>%%.txt
for /f "=2* ==:" %%a in ('/all^|find /i " " ^|/v "00-00-00-00"') do (
set name=%%a
echoMAC= %%a>>%%.txt
for /f "=2* ==:" %%a in ('/all^|find /i "描述" ^|/v "" ^|/v ""') do (
set name=%%a
echoModel = %%a>>%%.txt
for /f "=2* ==:" %%a in ('/all^|find /i "物理地址" ^|/v "00-00-00-00"') do (
set name=%%a
echoMAC= %%a>>%%.txt
ver|find /i " ">nul 2>nul&&goto xp||goto win7
:xp
for /f "=2* ==:" %%a in ('/all^|find /i "IP "') do (
set name=%%a
echoIP= %%a>>%%.txt
echo StartFor XP...
echo.>>%%.txt
echo:>>%%.txt
for /f "=7 =\" %%i in ('reg query "HKLM\\\\\" ^|/v "KB" 2^>nul') do (
for /f "skip=4 =2*" %%a in ('reg query "HKLM\\\\\\%%i" /v2^>nul' ) do (
echo %%b>>%%.txt
for /f "=2 =\" %%x in ('reg query HKU') do (
for /f "=8 =\" %%a in ('reg query "HKU\%%x\\\\\" 2^>nul') do (
for /f "skip=4 =2*" %%i in ('reg query "HKU\%%x\\\\\\%%a" /v "" 2^>nul') do (
echo %%j>>%%.txt
echo.>>%%.txt
if exist %%\\CCM\.exe echo "SMShas been , "

一键获取软硬件配置及管理员组

文章插图
if exist %%\\CCM\.exe echo "SMShas been , ">>%%.txt
echo ==================================================================
echo USB :
echo.>>%%.txt
echo USB :>>%%.txt
for /f "skip=4 =2*" %%a in ('reg query "HKLM\\\\" /v "start" 2^>nul' ) do (
if "%%b"=="0x4" echoUSB is Close
if "%%b"=="0x3" echoUSB is Open, Tag It.
if "%%b"=="0x4" echoUSB is Close>>%%.txt
if "%%b"=="0x3" echoUSB is Open, Tag It.>>%%.txt
goto last
:win7
for /f "=2* ==:" %%a in ('/all^|find /i "IPV4"') do (
set name=%%a
echoIP= %%a>>%%.txt
echo StartFor Win7/8 ...
rem for 32 win7
echo.>>%%.txt
echo:>>%%.txt
for /f "=7 =\" %%i in ('reg query "HKLM\\\\\" ^|/v "KB" 2^>nul ') do (
for /f "skip=2 =3* = " %%a in ('reg query "HKLM\\\\\\%%i" /v2^>nul') do (
echo %%a %%b>>%%.txt
for /f "=8 =\" %%i in ('reg query "HKLM\\\\\\" 2^>nul ^|/v "KB" 2^>nul ') do (
for /f "skip=2 =3* = " %%a in ('reg query "HKLM\\\\\\\%%i" /v2^>nul') do (
echo %%a %%b>>%%.txt
for /f "=2 =\" %%x in ('reg query HKU') do (
for /f "=8 =\" %%a in ('reg query "HKU\%%x\\\\\" 2^>nul') do (
for /f "skip=2 =2*" %%i in ('reg query "HKU\%%x\\\\\\%%a" /v "" 2^>nul') do (
echo %%j>>%%.txt
for /f "=2 =\" %%x in ('reg query HKU') do (
for /f "=9 =\" %%a in ('reg query "HKU\%%x\\\\\\" 2^>nul') do (
for /f "skip=2 =2*" %%i in ('reg query "HKU\%%x\\\\\\\%%a" /v "" 2^>nul') do (
echo %%j>>%%.txt
echo ==================================================================
echo USB :
echo.>>%%.txt
echo USB :>>%%.txt
for /f "skip=2 =2*" %%a in ('reg query "HKLM\\\\" /v "start" 2^>nul' ) do (
if "%%b"=="0x4" echoUSB is Close
if "%%b"=="0x3" echoUSB is Open, Tag It.
if "%%b"=="0x4" echoUSB is Close>>%%.txt
if "%%b"=="0x3" echoUSB is Open, Tag It.>>%%.txt
:last
echo ==================================================================
echo Admin Users:
echo.>>%%.txt
echo Admin Users:>>%%.txt
for /f "skip=6 =*" %%i in ('net^|/v "㏑" ^|/v "命" ^|/v ""') do (
echo%%i
echo%%i>>%%.txt
echo Power Users:
echo.>>%%.txt
echo Power Users:>>%%.txt
for /f "skip=6 =*" %%i in ('net"Power Users" ^|/v "㏑" ^|/v "命" ^|/v ""') do (
echo%%i
echo%%i>>%%.txt
echo ==================================================================
echo:
echo.>>%%.txt
echo:>>%%.txt
for /f "skip=4 =*" %%i in ('net share 2^>nul ^|/v "㏑" ^|/v "命" ^|/v ""' ) do (
echo %%i
echo %%i>>%%.txt
echo ========================= Over==============================
net use \\192.168.1.1/user: 1>nul 2>nul
copy %%.txt \\192.168.1.1\$\
net use \\192.168.1.1\IPC$ /del 1>nul 2>nul
pause
start %%.txt
現在來查看下掃描結果XP/WIN8對比
一键获取软硬件配置及管理员组

文章插图
以及產生的掃描結果
:
Name =
OSType =8.1 专业版 64-bit (6.3, Build 9600) (9600..-1505)
Model =Name
CPUModel = (R) Dual-Core CPUE5500 @ 2.80GHz (2 CPUs), ~2.8GHz
RAMSize =RAM
=
Card =基本显示适配器
= 256 MB
Board:
=INC.
Model= P5KPL-AM
Hard Disk:
Model= ATA
Size=5
Card:
Model =PCIe FE
MAC= 00-23-54-0A-31-A9
IP= 172.17.44.103(首选)
:
谷歌拼音输入法 2.7
7-Zip 9.30 (x64 )
Live MIME
Java 820 (64-bit)
C++ 2008- x64 9.0.30729.4148
Java SEKit 820 (64-bit)
Error
PDF-
C++ 2005(x64)
VIA 平台设备管理员
++
Live 软件包
Live UX
Live
Live UXPack
Junk Mail
3.5
Live Photo
C++ 2008- x86 9.0.30729.4148
Live 软件包
Live
Live
微软设备健康助手
Live
Java Auto
Live Mail
Live
4.3.0.4
Live
Live
Live
Live UXPack
Live 程式集
C++ 2005
Photo
C++ 2008- x86 9.0.21022
Adobe8 -
Live PIMT
Live Mail
Live Mail
Live SOXE
Live SOXE
Photo
WSE 3.0
C++ 2008- x86 9.0.21022.218
WSE 2.0 SP3
USB :
USB is Open, Tag It.
Admin Users:
Luke
Power Users:
:
ADMIN$C:\远程管理
C$C:\默认共享
IPC$远程 IPC
D$D:\默认共享
E$E:\默认共享
F$F:\默认共享
$D:\
D:\
D:\
D:\
D:\
【一键获取软硬件配置及管理员组】最新内容请见作者的页: