Category Archives: Microsoft Windows

How to pass custom command-lien parameters in InnoSetup

You can read custom parameters with the {param} constant, example: if ExpandConstant(‘{param:Mode|DefaultMode}’) = ‘DefaultMode’ then begin Log(‘Installing for default mode’); end else begin Log(‘Installing for different mode’); end;if ExpandConstant(‘{param:Mode|DefaultMode}’) = ‘DefaultMode’ then begin Log(‘Installing for default mode’); end else begin Log(‘Installing for different mode’); end; It works with syntax like /Name=Value. And can also be […]

Programmatically create desktop icon with InnoSetup

Inside “ssPostInstall” of CurStepChanged() add this code: //create user desktop shortcut ShortcutPath := ExpandConstant(‘{userdesktop}’) + ‘\YourApp.lnk’; CreateShellLink(ShortcutPath, ‘YourApp’, ExpandConstant(‘{app}\YourApp.exe’), ”, ExpandConstant(‘{app}’), ”, 0, SW_SHOWNORMAL);//create user desktop shortcut ShortcutPath := ExpandConstant(‘{userdesktop}’) + ‘\YourApp.lnk’; CreateShellLink(ShortcutPath, ‘YourApp’, ExpandConstant(‘{app}\YourApp.exe’), ”, ExpandConstant(‘{app}’), ”, 0, SW_SHOWNORMAL); If you want to disable desktop icon via command-line, use this: if ExpandConstant(‘{param:skipdesktopicon|false}’) <> ‘false’ […]

Detect VMWare Virtual Machine

How to detect VMWare Virtual Machine via WMIC: wmic bios get serialnumber /format:listwmic bios get serialnumber /format:list The output is like this: SerialNumber=VMware-56 4d 95 b1 5a fa 05 0f-28 d0 2d d4 a3 fe e2 5dSerialNumber=VMware-56 4d 95 b1 5a fa 05 0f-28 d0 2d d4 a3 fe e2 5d Alternatively you can query […]

Detect Microsoft Virtual PC Virtual Machine

How to detect Virtual PC Virtual Machine via WMIC: wmic baseboard get manufacturer, product /format:listwmic baseboard get manufacturer, product /format:list The output is like this: Manufacturer=Microsoft Corporation Product=Virtual MachineManufacturer=Microsoft Corporation Product=Virtual Machine Another way is to query “csproduct” like this: wmic csproduct get vendor, name /format:listwmic csproduct get vendor, name /format:list The output is like […]

InnoSetup error the servicemanager is not available

This error happens with InnoSetup v6+ It is related to functions used to manage Windows services, such as: function OpenServiceManager() : HANDLE; begin if UsingWinNT() = true then begin Result := OpenSCManager(”,”,SC_MANAGER_ALL_ACCESS); if Result = 0 then MsgBox(‘the servicemanager is not available’, mbError, MB_OK) end else begin MsgBox(‘only nt based systems support services’, mbError, MB_OK) […]

InnoSetup disable DesktopIcon via command-line

First make sure you have a task named “desktopicon”: [Tasks] Name: desktopicon; Description: Create a &desktop icon; GroupDescription: "Additional icons:"; Flags: checkedonce[Tasks] Name: desktopicon; Description: Create a &desktop icon; GroupDescription: "Additional icons:"; Flags: checkedonce You may also have the desktop icon in the [Icon] section: [Icons] Name: {userdesktop}\YourApp; Filename: {app}\YourApp.exe; Tasks: desktopicon[Icons] Name: {userdesktop}\YourApp; Filename: […]

Get Laptop Battery DeviceID and Name via WMIC

Query the Win32_Battery class via WMIC from command-line: WMIC Path Win32_Battery get DeviceID,Name /format:listWMIC Path Win32_Battery get DeviceID,Name /format:list The output is like this: DeviceID= ASUSTeKASUS Battery Name=ASUS BatteryDeviceID= ASUSTeKASUS Battery Name=ASUS Battery

Get Windows 7, 8, 10 License Information

Here is how to get Windows 10 license information via command-line: C:\Windows\SysWOW64\cscript.exe "C:\Windows\SysWOW64\slmgr.vbs" /dlvC:\Windows\SysWOW64\cscript.exe "C:\Windows\SysWOW64\slmgr.vbs" /dlv * You can even get if Windows is activated and genuine. This is an example output: icrosoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved.   Software licensing service version: 6.1.7601.17514   Name: Windows(R) […]

Convert InnoSetup EXE Installer to MSI

If you need to convert a InnoSetup EXE setup into MSI installer: https://www.exemsi.com/ Here you can download a Mozilla Firefox MSI package example: https://www.exemsi.com/popular-msi-packages/ Product is free but has also a paid version.