Skip to content

Instantly share code, notes, and snippets.

@sanjeetsuhag
Created June 13, 2018 04:30
Show Gist options
  • Save sanjeetsuhag/8d8963e5c45ffa00cc61eccb3154f476 to your computer and use it in GitHub Desktop.
Save sanjeetsuhag/8d8963e5c45ffa00cc61eccb3154f476 to your computer and use it in GitHub Desktop.
Name "HardwareFilterSample"
OutFile "installer.exe"
!include "StrFunc.nsh"
${StrRep}
Section
nsExec::ExecToStack '"C:\Windows\System32\wbem\wmic.exe" bios get serialnumber'
Pop $0
Pop $1
${StrRep} $1 $1 "SerialNumber" ""
${StrRep} $1 $1 " " ""
DetailPrint '"BIOS: $1'
nsExec::ExecToStack '"C:\Windows\System32\wbem\wmic.exe" baseboard get serialnumber'
Pop $0
Pop $1
${StrRep} $1 $1 "SerialNumber" ""
${StrRep} $1 $1 " " ""
DetailPrint '"Motherboard: $1'
nsExec::ExecToStack '"C:\Windows\System32\wbem\wmic.exe" nic get macaddress'
Pop $0
Pop $1
${StrRep} $1 $1 "MACAddress" ""
DetailPrint '"MAC Address: $1"'
nsExec::ExecToLog '"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Sort Manufacturer,Description,DeviceID | Ft -GroupBy Manufacturer Description,Service,DeviceID'
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment