|
![]() |
#1 |
Junior Member
Join Date: Sep 2022
Posts: 7
|
Processor, Memory, OS, SSD and TPM information
Hi,
I am trying to create an installer that checks to see if the current hardware meets minimum system requirements. In order to do this I need to processor, total physical RAM, operating system version and also mainly SSD and TPM information. I have searched the forums but i haven't found a function that will give me this information's like SSD and TPM Does anyone have any idea how i might accomplish this using NSIS script? |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
https://nsis.sourceforge.io/HwInfo_plug-in and http://forums.winamp.com/showthread.php?threadid=139639 should get you started.
WinVer.nsh for the Windows version. SSD might need WMI or something like that. I have no clue about TPM but if the software you are installing uses the TPM then I'm sure you know which API to call... IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 | |
Moderator
Join Date: Aug 2004
Location: Poland
Posts: 563
|
Quote:
- CPU Name, Speed? - Total RAM - OS Name, Version - SSD -> What info? Name, size, type? - TPM -> Active or Not? Most of that info can be easily gathered. As far as I know, TPM info can be obtained using WMI (Win32_TPM class) Ps: Maybe I will create simple plugin that show such info... need to find time and I wonder if there are more people that would like to see such plugin for NSIS -Pawel |
|
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Sep 2022
Posts: 7
|
Hi Thanks for your reply.
Yes i need a plugin which gives all these information like : - CPU Name - Total RAM - In GB - OS Name, Version - SSD -> Need Name of the SSD and Type - TPM -> Need Active or not and type or Name of TPM. It would be great if you provide me this plugin information. |
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Sep 2022
Posts: 7
|
And i have added the below powershell script to get the SSD info:
ForEach ($disk in (Get-PhysicalDisk | Select-Object FriendlyName, MediaType)){ If ($disk.MediaType -eq 'SSD'){ $SSDName = $disk.FriendlyName Write-host "SSD name " : $SSDName break } } This script i called from my .nsi script but how do i get the actual output from powershell to nsi script and get displayed? |
![]() |
![]() |
![]() |
#6 |
Junior Member
Join Date: Sep 2022
Posts: 7
|
Hi Pawel,
Did u get a chance to create the Plugin for the above data? |
![]() |
![]() |
![]() |
#7 |
Moderator
Join Date: Aug 2004
Location: Poland
Posts: 563
|
I am slowly trying to create something... But, it will take few more days...
You can check the follwoing demo. It should get info for Operating System and TPM Ps: I am not promising anything more soon... However, I am planning to add CPU/RAM and maybe Storage info tomorrow.... Edit: Link removed. See below. Polski Pakiet Językowy Winampa 5.91.0.10029 (WINAMP 5.91.0.10029) Polski Pakiet Językowy Winampa 5.6.6.3516 (WINAMP 5.6.6.3516) --- WINAMP PL | NSIS PL | WINAMP ICON PACKS | WINAMP COLOR THEMES | ULTIMATE FILE MANAGER !!! PLEASE DONATE !!! Last edited by Pawel; 28th September 2022 at 14:02. |
![]() |
![]() |
![]() |
#8 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
The nsExec plug-in can catch stdout strings.
Alternatively you can write it to a .ini in $pluginsdir. Make PS output something like Quote:
IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#9 |
Junior Member
Join Date: Sep 2022
Posts: 7
|
I have written Nsis script like below:
Push $R0 nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy RemoteSigned -File ""$EXEDIR\GetHWInfo1.ps1""' Pop $R0 ${If} $R0 == '0' MessageBox MB_OK "SSD exists" ${Else} MessageBox MB_OK " SSD not exists" ${EndIf} Is this correct? |
![]() |
![]() |
![]() |
#10 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
I don't know what your script looks like but you are checking the powershell.exe exit code and you are missing a pop.
PHP Code:
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#11 |
Moderator
Join Date: Aug 2004
Location: Poland
Posts: 563
|
SysInfo 1.0 Plugin for NSIS is now ready to test.
Plugin should run in Windows 7/8/10/11 with NSIS (unicode). Current version of plugin allows you to get the following data: OPERATING SYSTEM OS Caption | Manufacturer | Version | Build Number | Language | Locale | Code Set | Country Code | Edition ID | Display Version | Current Build Number | UBR | ReleaseID PROCESSOR (CPU) CPU Name | Description | Family | Manufacturer | Number of Cores | Number of Logical Processors | Architecture | Clock Speed | External Clock Speed | L2 Cache Size | L3 Cache Size MEMORY Total Physical Memory | Free Physical Memory | Used Physical Memory Total Virtual Memory | Free Virtual Memory | Used Virtual Memory Total PageFile Memory | Free PageFile Memory | Used PageFile Memory Total Installed Memory | Total Reserved Memory STORAGE DEVICE Disk Name | Disk Serial Number | Disk File System | Disk Drive Type | Disk Media Type Disk Drive Total Size | Disk Drive Free Space | Disk Drive Used Space Drive Media Type | Drive Model | Drive Description | Drive Manufacturer | Drive Serial Number Drive Interface Type | Drive Media Type | Drive Total Cylinders | Drive Tracks/Cylinder Drive Total Tracks | Drive Sectors/Track | Drive Total Sectors | Drive Bytes/Sector | Drive Total Heads | Drive Size TRUSTED PLATFORM MODULE IsActivated_InitialValue | IsEnabled_InitialValue | IsOwned_InitialValue | SpecVersion | ManufacturerVersion | ManufacturerVersionInfo | ManufacturerId | PhysicalPresenceVersionInfo Please, take a look into attached demo script, where you can see how to use it. -Pawel Polski Pakiet Językowy Winampa 5.91.0.10029 (WINAMP 5.91.0.10029) Polski Pakiet Językowy Winampa 5.6.6.3516 (WINAMP 5.6.6.3516) --- WINAMP PL | NSIS PL | WINAMP ICON PACKS | WINAMP COLOR THEMES | ULTIMATE FILE MANAGER !!! PLEASE DONATE !!! Last edited by Pawel; 28th September 2022 at 16:02. |
![]() |
![]() |
![]() |
#12 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
Which CPU does it get this information from? We now have asymmetrical CPUs (A.K.A big.LITTLE). Intel calls these cores P-Cores and E-Cores and they are effectively different CPUs inside a single CPU chip. On top of this Windows Server probably supports hot-swapping CPUs.
A few suggestions: Support queries for specific CPUs. Just naming these is hard. One solution is processor groups. When there are more than 64 cores there will be multiple groups. Input like "1.5" would mean core #5 in group #1. This scheme is annoying for the caller and maybe even annoying to implement with WMI but is easy with raw Win32. The other would just be a simple number ("winmgmts:root\cimv2:Win32_Processor='cpu0'"). Or support both. Something to help the OP here: GetFastestCPUMaximumCoreSpeed and GetSlowestCPUMaximumCoreSpeed. This should cover P-Cores vs E-Cores? For a game you probably only care about GetFastestCPUMaximumCoreSpeed. IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#13 |
Moderator
Join Date: Aug 2004
Location: Poland
Posts: 563
|
There is a problem with devices that are more then 1 (CPU or Graphic Card, etc)
I still don't know what would be the best for script user (dll caller). Maybe: CPU Name 1 | CPU Name 2 CPU Speed 1 | SPU Speed 2 But, user would have to know there are more then 1 device and would have to split it by "|". Graphic Card is a good example (it can be gpu buil-in CPU and external dedicated gpu). Maybe the answer is to chose active (default) and display info only for that one... How do you think? |
![]() |
![]() |
![]() |
#14 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
Not wanting to mess with CPU specifics, I made a wiki page that dumps some information. (No TPM support since I don't have one)
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#15 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
For graphic cards it probably makes sense to return information for the default/currently active. Perhaps a parameter that you set to "" for the default or a number/index for a specific GPU if the user wants to check all of them.
For CPUs the same somewhat applies although my suggestion for GetFastestCPUMaximumCoreSpeed should check all the CPUs and just return a usable number. I don't like the | pipe idea. Just using "" as input for some kind of default and an index or group/index pair for a specific CPU. What is the default? Who knows. Up until 2021 it did not matter much, most people just took the information from whatever CPU your thread is currently on but with the introduction of P/E cores you actually need to be specific in your internal code and should probably return the fastest CPU as the default. IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#16 |
Moderator
Join Date: Aug 2004
Location: Poland
Posts: 563
|
If I understand you well... Let's assume we have 2 CPU's .
So, I should get clock speed for first CPU and second CPU. Compare them and return data for faster cpu... Than can be done relatively easy. Btw, most computers have 1 CPU and 1 graphic card. |
![]() |
![]() |
![]() |
#17 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
Just to clarify, when I say CPU (in software) I mean physical core or logical core, never physical package/socket. Most CPUs these days have multiple physical cores.
A physical CPU package (the hardware chip you see on the motherboard with your eyes) is usually just one except on big servers. They contain one or several physical cores. Each physical core is able execute one or several logical cores (hyper threading). GetFastestCPUMaximumCoreSpeed should compare either every physical core or every logical core. The result should be the same AFAIK but testing logical cores may be easier. ![]() (2 physical packages, 4 cores in each for a total of 8. 16 logical cores in total.) IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#18 | |
Moderator
Join Date: Aug 2004
Location: Poland
Posts: 563
|
Quote:
As you said, almost all PC has single CPU (with many cores/logical cores). But, in my opionion I don't need to get speed of single core. Just max clock is enough to know user can run installed software or not. Example: Let's assume that installed software require at least: Specification: - CPU 2 [GHz] - RAM 8 [GB] - VRAM 2 [GB] NSIS script can get that data using the SysInfo plugin and make a comparison. User: - CPU 2.4 [GHz] -> OK - RAM 16 [GB] -> OK - VRAM 1 [GB] -> ! -> Can not install - not enough memory. There is a small problem with multiple devices, best example is Video Adapter (Graphic Card). My laptop has 2 GPU: - integrated with CPU (Intel 4600) - dedicated GPU (GeForce GTX 850M) What is the best way to choose better one? I decided to use the following alghoritm. I get graphics card RAM ("AdapterRAM" in WMI Win32_VideoController class query) for each graphic card and gather data for GPU with more RAM. Simple and easy! Of course, the problem is that in my laptop my GeForce is Offline (Intel is active). However, NVIDIA GPU is more powerfull and this is the choice (if user for example install a game that requires more GPU RAM). I will try to implement this in SysInfo 1.1 |
|
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|