Skip to content

Commit 9d7709f

Browse files
authored
Release 2.6.1.1 (#762)
* Fix CSV File Writes * Remove Debug Values * Add TSV, Default to HOSTNAME if no FILENAME specified * Detect if Directory and use HOSTNAME if so * Attempt to patch #758 * Remove debug statements * Finish #757 * Bump version
1 parent 2e00124 commit 9d7709f

File tree

1 file changed

+124
-27
lines changed

1 file changed

+124
-27
lines changed

WhyNotWin11.au3

+124-27
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#AutoIt3Wrapper_Res_Comment=https://www.whynotwin11.org
88
#AutoIt3Wrapper_Res_CompanyName=Robert Maehl Software
99
#AutoIt3Wrapper_Res_Description=Detection Script to help identify why your PC isn't Windows 11 Release Ready. Now Supporting Update Checks!
10-
#AutoIt3Wrapper_Res_Fileversion=2.6.1.0
10+
#AutoIt3Wrapper_Res_Fileversion=2.6.1.1
1111
#AutoIt3Wrapper_Res_ProductName=WhyNotWin11
12-
#AutoIt3Wrapper_Res_ProductVersion=2.6.1.0
12+
#AutoIt3Wrapper_Res_ProductVersion=2.6.1.1
1313
#AutoIt3Wrapper_Res_LegalCopyright=Robert Maehl, using LGPL 3 License
1414
#AutoIt3Wrapper_Res_Language=1033
1515
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
@@ -96,7 +96,8 @@ Func ProcessCMDLine()
9696
Local $sDrive = Null
9797
Local $bForce = False
9898
Local $bSilent = False
99-
Local $aOutput[3] = [False, "", ""]
99+
Local $aExtras[2] = ["",""]
100+
Local $aOutput[4] = [False, "", "", $aExtras]
100101
Local $iParams = $CmdLine[0]
101102

102103
If $aMUI[0] = Null Then
@@ -126,18 +127,19 @@ Func ProcessCMDLine()
126127
MsgBox(0, "Help and Flags", _
127128
"Checks PC for Windows 11 Release Compatibility" & @CRLF & _
128129
@CRLF & _
129-
"WhyNotWin11 [/export FORMAT FILENAME] [/drive DRIVE:] [/force] [/fuonly] [/silent] [/skip [check]] [/update [branch]]" & @CRLF & _
130+
"WhyNotWin11 [/drive DRIVE:] [/export FORMAT [FILENAME]] [/extras DATA] [/force] [/fuonly] [/silent] [/skip CHECK] [/update [BUILD]]" & @CRLF & _
130131
@CRLF & _
131-
@TAB & "/export" & @TAB & "Export Results in an Available format, can be used" & @CRLF & _
132+
@TAB & "/drive " & @TAB & "Overrides which Disk Drive to run checks on." & @CRLF & _
133+
@TAB & "/export" & @TAB & "Export Results in CSV, TSV, or TXT, can be used" & @CRLF & _
132134
@TAB & " " & @TAB & "without the /silent flag for both GUI and file" & @CRLF & _
133-
@TAB & " " & @TAB & "output. Requires a filename if used." & @CRLF & _
134-
@TAB & "formats" & @TAB & "TXT, CSV" & @CRLF & _
135+
@TAB & " " & @TAB & "output. Defaults to HOSTNAME if no filename set." & @CRLF & _
136+
@TAB & "/extras" & @TAB & "Extra data to output when using /export (See Wiki." & @CRLF & _
135137
@TAB & "/force " & @TAB & "Ignores program system requirements (e.g. WinPE)" & @CRLF & _
136138
@TAB & "/fuonly" & @TAB & "Checks Win11 Feature Update compatibility" & @CRLF & _
137139
@TAB & "/silent" & @TAB & "Don't Display the GUI. Compatible Systems will Exit" & @CRLF & _
138140
@TAB & " " & @TAB & "with ERROR_SUCCESS." & @CRLF & _
139-
@TAB & "/skip " & @TAB & "Skips a Comma Separated List of Checks (see Wiki)" & @CRLF & _
140-
@TAB & "/update" & @TAB & "Downloads the latest RELEASE (default) or DEV build" & @CRLF & _
141+
@TAB & "/skip " & @TAB & "Skips a Comma Separated List of Checks (see Wiki)." & @CRLF & _
142+
@TAB & "/update" & @TAB & "Downloads the latest RELEASE (default) or DEV build." & @CRLF & _
141143
@CRLF & _
142144
"Refer to https://WhyNotWin11.org/wiki/Command-Line-Switches for more details" & @CRLF)
143145
Exit 0
@@ -156,24 +158,70 @@ Func ProcessCMDLine()
156158
EndSelect
157159
Case "/e", "/export", "/format"
158160
Select
159-
Case UBound($CmdLine) <= 3
160-
MsgBox(0, "Invalid", "Missing FILENAME parameter for /format." & @CRLF)
161-
Exit 87 ; ERROR_INVALID_PARAMETER
162161
Case UBound($CmdLine) <= 2
163162
MsgBox(0, "Invalid", "Missing FORMAT parameter for /format." & @CRLF)
164163
Exit 87 ; ERROR_INVALID_PARAMETER
165164
Case Else
166165
Switch $CmdLine[2]
167-
Case "CSV", "TXT"
166+
Case "CSV", "TSV", "TXT"
168167
$aOutput[0] = True
169168
$aOutput[1] = $CmdLine[2]
170-
$aOutput[2] = $CmdLine[3]
171-
_ArrayDelete($CmdLine, "1-3")
169+
Select
170+
Case UBound($CmdLine) <= 3
171+
ContinueCase
172+
Case StringLeft($CmdLine[3], 1) = "/"
173+
$aOutput[2] = @ComputerName & "." & $CmdLine[2]
174+
_ArrayDelete($CmdLine, "1-2")
175+
Case Else
176+
$aOutput[2] = $CmdLine[3]
177+
If StringInStr(FileGetAttrib($CmdLine[3]), "D") Then
178+
If Not StringRight($CmdLine[3], 1) <> "\" Then $aOutput[2] &= "\"
179+
$aOutput[2] &= @ComputerName & "." & $CmdLine[2]
180+
EndIf
181+
_ArrayDelete($CmdLine, "1-3")
182+
EndSelect
172183
Case Else
173184
MsgBox(0, "Invalid", "Invalid FORMAT parameter for /format." & @CRLF)
174185
Exit 87 ; ERROR_INVALID_PARAMETER
175186
EndSwitch
176187
EndSelect
188+
Case "/ex", "/extras"
189+
Select
190+
Case UBound($CmdLine) <= 2
191+
MsgBox(0, "Invalid", "Missing DATA parameter for /extras." & @CRLF)
192+
Exit 87 ; ERROR_INVALID_PARAMETER
193+
Case Else
194+
$aTemp = StringSplit($CmdLine[2], ",", $STR_NOCOUNT)
195+
For $iLoop = 0 To UBound($aTemp) - 1
196+
Switch $aTemp[$iLoop]
197+
Case "BUILD"
198+
$aExtras[0] &= ",OS Build"
199+
$aExtras[1] &= "," & @OSBuild
200+
Case "KEYBOARD"
201+
$aExtras[0] &= ",Keyboard Langauage"
202+
$aExtras[1] &= "," & @KBLayout
203+
Case "LANGUAGE"
204+
$aExtras[0] &= ",OS Langauage"
205+
$aExtras[1] &= "," & @OSLang
206+
Case "MUI"
207+
$aExtras[0] &= ",MUI Langauage"
208+
$aExtras[1] &= "," & @MUILang
209+
Case "OS"
210+
$aExtras[0] &= ",Operating System"
211+
$aExtras[1] &= "," & @OSVersion
212+
Case "USER"
213+
$aExtras[0] &= ",Logged In User"
214+
$aExtras[1] &= "," & @UserName
215+
Case Else
216+
MsgBox(0, "Invalid", "Invalid DATA parameter for /extras." & @CRLF)
217+
Exit 87 ; ERROR_INVALID_PARAMETER
218+
EndSwitch
219+
Next
220+
$aExtras[0] = StringTrimLeft($aExtras[0], 1)
221+
$aExtras[1] = StringTrimLeft($aExtras[1], 1)
222+
$aOutput[3] = $aExtras
223+
_ArrayDelete($CmdLine, "1-2")
224+
EndSelect
177225
Case "/f", "/force"
178226
$bForce = True
179227
_ArrayDelete($CmdLine, 1)
@@ -339,7 +387,7 @@ Func ProcessCMDLine()
339387
EndIf
340388
If $aOutput[0] = True Then OutputResults($aResults, $aSkips, $aOutput)
341389
For $iLoop = 0 To 10 Step 1
342-
If $aResults[$iLoop][0] = False Or $aResults[$iLoop][0] < 1 Then Exit 1
390+
If ($aResults[$iLoop][0] = False Or $aResults[$iLoop][0] < 1) And Not $aSkips[$iLoop] Then Exit 1
343391
Next
344392
Exit 0
345393
EndFunc ;==>ProcessCMDLine
@@ -1346,9 +1394,21 @@ EndFunc ;==>FinalizeResults
13461394
Func OutputResults(ByRef $aResults, ByRef $aSkips, $aOutput)
13471395

13481396
Local $sFile, $hFile, $sOut = ""
1397+
Local $aExtras, $aExtraData
13491398

13501399
Local $aLabel[11] = ["Architecture", "Boot Method", "CPU Compatibility", "CPU Core Count", "CPU Frequency", "DirectX + WDDM2", "Disk Partition Type", "RAM Installed", "Secure Boot", "Storage Available", "TPM Version"]
13511400

1401+
$aExtras = $aOutput[3]
1402+
1403+
_ArrayAdd($aLabel, StringSplit($aExtras[0], ",", $STR_NOCOUNT))
1404+
$aExtraData = StringSplit($aExtras[1], ",", $STR_NOCOUNT)
1405+
1406+
If $aLabel[11] <> "" Then
1407+
;;;
1408+
Else
1409+
_ArrayDelete($aLabel, 11)
1410+
EndIf
1411+
13521412
Switch $aOutput[1]
13531413
Case "txt"
13541414
If StringInStr($aOutput[2], ":") Or StringInStr($aOutput[2], "\\") Then
@@ -1358,11 +1418,44 @@ Func OutputResults(ByRef $aResults, ByRef $aSkips, $aOutput)
13581418
EndIf
13591419
$hFile = FileOpen($sFile, $FO_CREATEPATH + $FO_OVERWRITE)
13601420
$sOut = "Results for " & @ComputerName & @CRLF
1361-
For $iLoop = 0 To 10 Step 1
1362-
If $aSkips[$iLoop] Then
1363-
$sOut &= $aLabel[$iLoop] & @TAB & True & @TAB & "Skipped" & @TAB & "Skipped" & @CRLF
1421+
For $iLoop = 0 To UBound($aLabel) - 1 Step 1
1422+
If $iLoop > 10 Then
1423+
$sOut &= $aLabel[$iLoop] & ": " & $aExtraData[$iLoop - 11] & @CRLF
13641424
Else
1365-
$sOut &= $aLabel[$iLoop] & @TAB & $aResults[$iLoop][0] & @TAB & $aResults[$iLoop][1] & @TAB & $aResults[$iLoop][2] & @CRLF
1425+
If $aSkips[$iLoop] Then
1426+
$sOut &= $aLabel[$iLoop] & @TAB & True & @TAB & "Skipped" & @TAB & "Skipped" & @CRLF
1427+
Else
1428+
$sOut &= $aLabel[$iLoop] & @TAB & $aResults[$iLoop][0] & @TAB & $aResults[$iLoop][1] & @TAB & $aResults[$iLoop][2] & @CRLF
1429+
EndIf
1430+
EndIf
1431+
Next
1432+
1433+
Case "tsv"
1434+
If StringInStr($aOutput[2], ":") Or StringInStr($aOutput[2], "\\") Then
1435+
$sFile = $aOutput[2]
1436+
Else
1437+
$sFile = @ScriptDir & "\" & $aOutput[2]
1438+
EndIf
1439+
If Not FileExists($sFile) Then
1440+
$hFile = FileOpen($sFile, $FO_CREATEPATH + $FO_OVERWRITE)
1441+
$sOut = "Hostname"
1442+
For $iLoop = 0 To UBound($aLabel) - 1 Step 1
1443+
$sOut &= @TAB & $aLabel[$iLoop]
1444+
Next
1445+
FileWrite($hFile, $sOut & @CRLF)
1446+
Else
1447+
$hFile = FileOpen($sFile, $FO_APPEND)
1448+
EndIf
1449+
$sOut = @ComputerName
1450+
For $iLoop = 0 To UBound($aLabel) - 1 Step 1
1451+
If $iLoop > 10 Then
1452+
$sOut &= @TAB & $aExtraData[$iLoop - 11]
1453+
Else
1454+
If $aSkips[$iLoop] Then
1455+
$sOut &= @TAB & True
1456+
Else
1457+
$sOut &= @TAB & $aResults[$iLoop][0]
1458+
EndIf
13661459
EndIf
13671460
Next
13681461

@@ -1374,20 +1467,24 @@ Func OutputResults(ByRef $aResults, ByRef $aSkips, $aOutput)
13741467
EndIf
13751468
If Not FileExists($sFile) Then
13761469
$hFile = FileOpen($sFile, $FO_CREATEPATH + $FO_OVERWRITE)
1377-
$sOut = FileWrite($hFile, "Hostname")
1378-
For $iLoop = 0 To 10 Step 1
1379-
$sOut &= FileWrite($hFile, "," & $aLabel[$iLoop])
1470+
$sOut = "Hostname"
1471+
For $iLoop = 0 To UBound($aLabel) - 1 Step 1
1472+
$sOut &= "," & $aLabel[$iLoop]
13801473
Next
13811474
FileWrite($hFile, $sOut & @CRLF)
13821475
Else
13831476
$hFile = FileOpen($sFile, $FO_APPEND)
13841477
EndIf
13851478
$sOut = @ComputerName
1386-
For $iLoop = 0 To 10 Step 1
1387-
If $aSkips[$iLoop] Then
1388-
$sOut &= FileWrite($hFile, "," & True)
1479+
For $iLoop = 0 To UBound($aLabel) - 1 Step 1
1480+
If $iLoop > 10 Then
1481+
$sOut &= "," & $aExtraData[$iLoop - 11]
13891482
Else
1390-
$sOut &= FileWrite($hFile, "," & $aResults[$iLoop][0])
1483+
If $aSkips[$iLoop] Then
1484+
$sOut &= "," & True
1485+
Else
1486+
$sOut &= "," & $aResults[$iLoop][0]
1487+
EndIf
13911488
EndIf
13921489
Next
13931490

0 commit comments

Comments
 (0)