WhyNotWin11
WhyNotWin11 copied to clipboard
Resolved : Add Current OS Build to file export
Would it be possible to include current OS Build number into the File Export ( TXT or CSV )
Results for
For those of us who will be using this great piece of software in a remote way, then this would help to ensure that the Computer is currently on Win10, and is capable of upgrading to Win 11
Was able to resolve myself. For .TXT exports, this adds a line OS Build WIN_10:19045,X64 for .CSV exports, adds a new column "OSINFO", and report WIN_10:19045
For anyone intrested - modified the WhyNotWin11.au3 file as follows Func OutputResults(ByRef $aResults, ByRef $aSkips, $aOutput)
Local $sFile, $hFile, $sOut = ""
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"]
Switch $aOutput[1]
Case "txt"
If StringInStr($aOutput[2], ":") Or StringInStr($aOutput[2], "\\") Then
$sFile = $aOutput[2]
Else
$sFile = @ScriptDir & "\" & $aOutput[2]
EndIf
$hFile = FileOpen($sFile, $FO_CREATEPATH + $FO_OVERWRITE)
$sOut = "Results for " & @ComputerName & @CRLF & "OS Build " & @OSVersion & ":" & @OSBuild & ":" & @OSArch & @CRLF
For $iLoop = 0 To 10 Step 1
If $aSkips[$iLoop] Then
$sOut &= $aLabel[$iLoop] & @TAB & True & @TAB & "Skipped" & @TAB & "Skipped" & @CRLF
Else
$sOut &= $aLabel[$iLoop] & @TAB & $aResults[$iLoop][0] & @TAB & $aResults[$iLoop][1] & @TAB & $aResults[$iLoop][2] & @CRLF
EndIf
Next
Case "csv"
If StringInStr($aOutput[2], ":") Or StringInStr($aOutput[2], "\\") Then
$sFile = $aOutput[2]
Else
$sFile = @ScriptDir & "\" & $aOutput[2]
EndIf
If Not FileExists($sFile) Then
$hFile = FileOpen($sFile, $FO_CREATEPATH + $FO_OVERWRITE)
$sOut = FileWrite($hFile, "Hostname")
$sOut &= FileWrite($hFile, ",OSInfo")
For $iLoop = 0 To 10 Step 1
$sOut &= FileWrite($hFile, "," & $aLabel[$iLoop])
Next
FileWrite($hFile, $sOut & @CRLF)
Else
$hFile = FileOpen($sFile, $FO_APPEND)
EndIf
;;;$sOut = @ComputerName
$sOut = FileWrite($hFile, @ComputerName)
$sOut &= FileWrite($hFile, "," & @OSVersion & ":" & @OSBuild & ":" & @OSArch)
For $iLoop = 0 To 10 Step 1
If $aSkips[$iLoop] Then
$sOut &= FileWrite($hFile, "," & True)
Else
$sOut &= FileWrite($hFile, "," & $aResults[$iLoop][0])
EndIf
Next
Case Else
;;;
EndSwitch
FileWrite($hFile, $sOut & @CRLF)
FileClose($hFile)
EndFunc ;==>OutputResults
Would you be okay with this information being after the columns of results? The CSV data order has been consistent for some time now and I'd like to keep other people's scripts/workflows in mind.
Hi, Yes the position in the CSV file for me does not matter, so please adjust as necessary. You will also see that i corrected the issue in CSV outputs where no Hostname was output.
@supertramp4 prs welcome :trollface:
@supertramp4 prs welcome :trollface:
Nah, I'm adding a lot more improvements than just the OS Version and Build #.