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?
Processor, Memory, OS, SSD and TPM information
18 posts
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...
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...
What do you need?Originally Posted by Mike-Sean View PostIn order to do this I need to processor, total physical RAM, operating system version and also mainly SSD and TPM information.
- 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
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.
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.
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?
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?
The nsExec plug-in can catch stdout strings.
Alternatively you can write it to a .ini in $pluginsdir. Make PS output something like
Alternatively you can write it to a .ini in $pluginsdir. Make PS output something like
[ssd]and use the NSIS ini functions to read 0..N-1
0=name1here
1=name2here
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?
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?
I don't know what your script looks like but you are checking the powershell.exe exit code and you are missing a pop.
Section
nsExec::ExecToStack '"$sysdir\cmd.exe" /C echo Hello World %random%'
Pop $0
Pop $1
MessageBox MB_OK 'Process exit code: $0$\n$\nStdOut: $1'
SectionEnd Hi Pawel,
Did u get a chance to create the Plugin for the above data?
Did u get a chance to create the Plugin for the above data?
I am slowly trying to create something... But, it will take few more days...Originally Posted by Mike-Sean View PostDid u get a chance to create the Plugin for the above data?
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.
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
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
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.Originally Posted by Pawel View PostPROCESSOR (CPU)
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.
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)
There is a problem with devices that are more then 1 (CPU or Graphic Card, etc)Originally Posted by Anders View PostSupport queries for specific CPUs.
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?
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.
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.
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.
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.
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.)
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.)
I fully agree. But, the plugin purpose is to show basic PC parameters to know software can be installed or not.Originally Posted by Anders View PostJust 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.
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