-
Notifications
You must be signed in to change notification settings - Fork 3
/
xxSysInfo.bat
300 lines (266 loc) · 8.96 KB
/
xxSysInfo.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
@ECHO off
REM Clean and Configure
SET ST=%time%
SETLOCAL EnableDelayedExpansion
TITLE Status: Working...
COLOR 0a
CLS
chcp 65001>nul
REM Heading
ECHO ==========================
ECHO === xxSysInfo v1.0
ECHO ==========================
ECHO = Usage: xxSysInfo.bat -l D:\info.txt
ECHO = Or just: xxSysInfo.bat for default log file.
ECHO ==========================
ECHO.
REM Input parameters
if "%~1"=="-l" (GOTO SPECIFIC) ELSE (GOTO UNKNOWN)
:SPECIFIC
SET "logfile=%~2"
ECHO Using %logfile% as log file.
GOTO CONTINUE
:UNKNOWN
SET "logfile=%cd%\sysInfo.txt"
ECHO Using %logfile% as log file.
GOTO CONTINUE
:CONTINUE
REM Check logfile existance
if EXIST %logfile%. (
ECHO Warning: File exists.
ECHO Appending information...
) ELSE (
ECHO File created.
ECHO Appending information...
)
REM Date
ECHO ============= >> %logfile%
ECHO === Log created at: >> %logfile%
ECHO ============= >> %logfile%
ECHO Date and time: >> %logfile%
ECHO %date%-%time% >> %logfile% 2>&1
ECHO Timezone: >> %logfile%
wmic Timezone get DaylightName,Description,StandardName |more >> %logfile% 2>&1
REM Basic Information
ECHO ============= >> %logfile%
ECHO === Basic Information: >> %logfile%
ECHO ============= >> %logfile%
ECHO Output of whoami: >> %logfile%
whoami >> %logfile% 2>&1
ECHO Output of %^%username%^%: >> %logfile%
ECHO %username% >> %logfile% 2>&1
ECHO Output of %^%computername%^%: >> %logfile%
ECHO %computername% >> %logfile% 2>&1
REM Net Users
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Net Users: >> %logfile%
ECHO ============= >> %logfile%
net users >> %logfile% 2>&1
REM Environment Variables
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Environment Variables: >> %logfile%
ECHO ============= >> %logfile%
ECHO Output of SET: >> %logfile%
set >> %logfile% 2>&1
ECHO Output of %^%cmdextversion%^%: >> %logfile%
echo %cmdextversion% >> %logfile% 2>&1
ECHO Output of %^%cmdcmdline%^%: >> %logfile%
echo %cmdcmdline% >> %logfile% 2>&1
ECHO Output of %^%errorlevel%^%: >> %logfile%
echo %errorlevel% >> %logfile% 2>&1
REM Full Systeminfo
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Full Systeminfo: >> %logfile%
ECHO ============= >> %logfile%
systeminfo >> %logfile% 2>&1
REM IPConfig
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === IPConfig: >> %logfile%
ECHO ============= >> %logfile%
ipconfig /all >> %logfile% 2>&1
REM Routes
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Routes: >> %logfile%
ECHO ============= >> %logfile%
route print >> %logfile% 2>&1
REM ARP
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === ARP: >> %logfile%
ECHO ============= >> %logfile%
arp -A >> %logfile% 2>&1
REM Netstat
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Netstat: >> %logfile%
ECHO ============= >> %logfile%
netstat -ano >> %logfile% 2>&1
REM Firewall State
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Firewall State: >> %logfile%
ECHO ============= >> %logfile%
netsh firewall show state >> %logfile% 2>&1
REM Firewall Config
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Firewall Config: >> %logfile%
ECHO ============= >> %logfile%
netsh firewall show config >> %logfile% 2>&1
REM Scheduled Tasks
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Scheduled Tasks: >> %logfile%
ECHO ============= >> %logfile%
schtasks /query /fo LIST /v >> %logfile% 2>&1
REM Processes
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Processes: >> %logfile%
ECHO ============= >> %logfile%
ECHO Tasklist: >> %logfile% 2>&1
tasklist /SVC >> %logfile% 2>&1
ECHO WMIC: >> %logfile% 2>&1
wmic process get CSName,Description,ExecutablePath,ProcessId |more >> %logfile% 2>&1
REM Services
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Services: >> %logfile%
ECHO ============= >> %logfile%
ECHO Net: >> %logfile% 2>&1
net start >> %logfile% 2>&1
ECHO WMIC: >> %logfile% 2>&1
wmic service get Caption,Name,PathName,ServiceType,Started,StartMode,StartName |more >> %logfile% 2>&1
REM Driver Information
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Driver Information: >> %logfile%
ECHO ============= >> %logfile%
DRIVERQUERY >> %logfile% 2>&1
REM Windows Updates Information
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Windows Updates Information: >> %logfile%
ECHO ============= >> %logfile%
wmic qfe get Caption,Description,HotFixID,InstalledOn |more >> %logfile% 2>&1
REM %path%
ECHO ============= >> %logfile%
ECHO === Output of %^%path%^%: >> %logfile%
ECHO ============= >> %logfile%
ECHO %path% >> %logfile% 2>&1
REM Useraccount SID
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Useraccount SID: >> %logfile%
ECHO ============= >> %logfile%
wmic useraccount where name='%username%' get sid |more >> %logfile% 2>&1
REM IE Version
ECHO ============= >> %logfile%
ECHO === IE versions: >> %logfile%
ECHO ============= >> %logfile%
%windir%\system32\reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v svcVersion >NUL 2>NUL
if not ErrorLevel 1 (
FOR /f "usebackq tokens=3" %%i in (`%windir%\system32\reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v svcVersion ^| %windir%\system32\findstr /i /l /c:"REG_SZ"`) do SET _IEVersion=%%i
) else (
REM svcVersion KEY NOT Found. Must be IE9 or earlier so use Version Key
FOR /f "usebackq tokens=3" %%i in (`%windir%\system32\reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v Version ^| %windir%\system32\findstr /i /l /c:"REG_SZ"`) do SET _IEVersion=%%i
)
REM Get IE major version
FOR /f "tokens=1 Delims=." %%i in ("%_IEVERSION%") do SET _IEMajorVersion=%%i
ECHO Major: %_IEMajorVersion% ^| Minor: %_IEVersion% >> %logfile% 2>&1
REM Service Pack Information
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Service Pack Information: >> %logfile%
ECHO ============= >> %logfile%
wmic os get ServicePackMajorVersion /value |more >> %logfile% 2>&1
REM Drives
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Drives: >> %logfile%
ECHO ============= >> %logfile%
ECHO System Drive: >> %logfile% 2>&1
ECHO %systemdrive% >> %logfile% 2>&1
ECHO All drives: >> %logfile% 2>&1
fsutil fsinfo drives >> %logfile% 2>&1
ECHO System drive type: >> %logfile% 2>&1
fsutil fsinfo driveType %systemdrive% >> %logfile% 2>&1
ECHO WMIC: >> %logfile% 2>&1
wmic volume get Label,DeviceID,DriveLetter,FileSystem,Capacity,FreeSpace |more >> %logfile% 2>&1
REM CPU
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === CPU: >> %logfile%
ECHO ============= >> %logfile%
ECHO Architecture: >> %logfile% 2>&1
ECHO %processor_architecture% >> %logfile% 2>&1
ECHO WMIC: >> %logfile% 2>&1
wmic CPU get Description, DeviceID, Manufacturer, MaxClockSpeed, Name, Status, SystemName |more >> %logfile% 2>&1
REM Network Shares
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Network Shares: >> %logfile%
ECHO ============= >> %logfile%
wmic netuse list |more >> %logfile% 2>&1
REM Full Group List
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Full Group List: >> %logfile%
ECHO ============= >> %logfile%
wmic group list full |more >> %logfile% 2>&1
REM Full Useraccounts List
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Full Useraccounts List: >> %logfile%
ECHO ============= >> %logfile%
wmic USERACCOUNT list full |more >> %logfile% 2>&1
REM Products
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Products: >> %logfile%
ECHO ============= >> %logfile%
wmic PRODUCT get Description,InstallDate,InstallLocation,PackageCache,Vendor,Version |more >> %logfile% 2>&1
REM Startup
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === Startup: >> %logfile%
ECHO ============= >> %logfile%
wmic startup get Caption,Command,Location,User |more >> %logfile% 2>&1
REM OS
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === OS: >> %logfile%
ECHO ============= >> %logfile%
wmic os get name,version,InstallDate,LastBootUpTime,LocalDateTime,Manufacturer,RegisteredUser,ServicePackMajorVersion,SystemDirectory |more >> %logfile% 2>&1
REM NIC
ECHO. >> %logfile%
ECHO ============= >> %logfile%
ECHO === NIC: >> %logfile%
ECHO ============= >> %logfile%
wmic nicconfig where IPEnabled='true' get Caption,DefaultIPGateway,Description,DHCPEnabled,DHCPServer,IPAddress,IPSubnet,MACAddress |more >> %logfile% 2>&1
REM Nice ending
TITLE Status: Done.
REM Start, end time difference and adjustments
FOR /f "tokens=1-3 delims=:" %%a in ("%ST%") do SET /a h1=%%a & SET /a m1=%%b & SET /a s1=%%c
FOR /f "tokens=1-3 delims=:" %%a in ("%TIME%") do SET /a h2=%%a & SET /a m2=%%b & SET /a s2=%%c
SET /a h3=%h2%-%h1% & SET /a m3=%m2%-%m1% & SET /a s3=%s2%-%s1%
if %h3% LSS 0 SET /a h3=%h3%+24
if %m3% LSS 0 SET /a m3=%m3%+60 & SET /a h3=%h3%-1
if %s3% LSS 0 SET /a s3=%s3%+60 & SET /a m3=%m3%-1
REM Calculate log size
FOR %%I in (%logfile%) do SET /a xbytesize=%%~zI
SET /a xmbsize=%xbytesize%/1024/1024
ECHO Generated %xbytesize% bytes (~%xmbsize% mb) log file in %h3%:%m3%:%s3% seconds.
ECHO.
ECHO =============
ECHO Done!
ECHO =============
ECHO.
ECHO Press any key to exit...
PAUSE>nul
EXIT