Create Virtual directory in IIS with Inno Setup - iis

Hi I need a help to create a Virtual directory.
I tried use these commands, but none works:
[Run]
Filename: "{cmd}"; parameters: "/C""net %systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"
Filename: "net.exe"; parameters: "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"
Filename: "{cmd}"; parameters: "/C""%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"
Filename: "{cmd}"; parameters: "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"
Filename: "cmd.exe"; parameters: "/C "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/DSERVER /physicalPath:D:\server1 /username:USER /password:PWD""
Filename: "cmd.exe"; parameters: "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"

This is the correct syntax:
[Run]
FileName: {sys}\inetsrv\appcmd.exe; \
Parameters: "add vdir /app.name:""Default Web Site/"" /path:/server1/ /physicalPath:D:\server1 /username:USER /password:PWD"
Your attempts didn't work because:
In many, you try to run net, why?
You have the quotes all wrong.
To embed a double-quote character inside a quoted value, use two consecutive double-quote characters.
See Parameters in Sections.
Environment variables (%systemroot%) are resolved on command-line or in a batch file, but not in general when providing arguments to programs. If you want Inno Setup to resolve the variable for you, use syntax {%SystemRoot}. Though in this case, it's better to use {sys}.
See Inno Setup Constants.
While not a problem on its own, there's no point trying to run .exe (appcmd.exe) via command-interpreter (cmd.exe).

Related

Use both 32-bit and 64-bit version of rundll32.exe in Inno Setup

I want to convert theses two lines that I have in a batch file to Inno Setup [Run] section:
%windir%\SysWOW64\rundll32.exe "%~dp0my32.dll",RegDll
%windir%\system32\rundll32.exe "%~dp0my64.dll",RegDll
So I want something like this (but working):
[Run]
Filename: "{sys}\rundll32.exe"; Parameters: ""{code:GetDir|0}\my64.dll",RegDll"; WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser
Filename: "{syswow64}\rundll32.exe"; Parameters: ""{code:GetDir|0}\my32.dll",RegDll"; WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser
Your code is correct in 64-bit install mode, i.e. if you have ArchitecturesInstallIn64BitMode set:
[Setup]
ArchitecturesInstallIn64BitMode=x64
In 32-bit install mode, Inno Setup, being 32-bit application, will get redirected to C:\WINDOWS\SysWOW64, when it tries to access C:\Windows\System32. So effectively, both sys and syswow64 map to the same [32-bit] folder (C:\WINDOWS\SysWOW64).
You can override that (if you do not want to switch to 64-bit install mode) by using 64bit flag:
[Run]
Filename: "{sys}\rundll32.exe"; Parameters: """{code:GetDir|0}\my64.dll"",RegDll"; \
WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; \
MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser; Flags: 64bit;
Filename: "{sys}\rundll32.exe"; Parameters: """{code:GetDir|0}\my32.dll"",RegDll"; \
WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; \
MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser; Flags: 32bit;

Create desktop link Icon after the Run section of Inno Setup

Overview
My install process involves placing over 2GB of data on a disk. So I use Inno Setup, but I run 7ZIP to actually extract/install the files.
Issue
The issue I have is that it seems the desktop icon is being created before the [Run] section, so there is no icon to set the the desktop link. Is there a way around this? (I have tried both {src} and {app} as the folder to find the icon.)
CODE
[Run]
Filename: "{pf64}\7-zip\7zG.exe"; Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
Flags: runascurrentuser
[Icons]
Name: "{group}\EGPL Watson Uninstall"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
Name: "{commondesktop}\DashBoard"; \
Filename: "{app}\dashboard\node_modules\electron\dist\electron.exe"; \
WorkingDir: "{app}\dashboard"; IconFilename: "{src}\dashboard\build\configure.ico"; \
Parameters: "main.js"; AfterInstall: SetElevationBit('{commondesktop}\DashBoard.lnk')
A quick and dirty solution is to set ChangesAssociations:
[Setup]
ChangesAssociations=yes
It makes Windows Explorer refresh all icons after the installer finishes.
A clean solution is to create the icon only after the [Run] section using CreateShellLink:
[Run]
Filename: "{pf64}\7-zip\7zG.exe"; \
Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
Flags: runascurrentuser; AfterInstall: CreateIcon
[Code]
procedure CreateIcon;
var
IconFileName: string;
begin
IconFileName := ExpandConstant('{commondesktop}\DashBoard.lnk');
CreateShellLink(
IconFileName, '',
ExpandConstant('{app}\dashboard\node_modules\electron\dist\electron.exe'),
'main.js', ExpandConstant('{app}\dashboard'),
ExpandContant('{app}\dashboard\build\configure.ico'), 0, SW_SHOWNORMAL);
SetElevationBit(IconFileName);
end;

Inno Setup doesn't create a scheduled task

My installer should install a Windows scheduled task for the application. The task definition is provided in an XML file. Installing the XML task file interactively works fine. But the installer doesn't install the task. Since I don't see its output, I don't know whether an error message is displayed. Windows event log doesn't contain anything.
The Inno Setup task "InstallAutostart" is checked so this should be executed. The files are copied to the installation directory.
Here's the script:
[Run]
Filename: "schtasks.exe"; Parameters: "/create /tn TClockAutostart /xml ""{app}\StartTClock.xml"""; WorkingDir: "{app}"; Description: "Install task for safe automatic start"; Tasks: InstallAutostart; Check: Not IsWin64
Filename: "schtasks.exe"; Parameters: "/create /tn TClockAutostart /xml ""{app}\StartTClock64.xml"""; WorkingDir: "{app}"; Description: "Install task for safe automatic start"; Tasks: InstallAutostart; Check: IsWin64
What's wrong here? How can I debug this?

Inno Setup: Check if OpenDCL is installed, otherwise install it

I want that my script checks, if OpenDCL is installed. If it isn't, it should install it.
This is the code:
Source:
[Setup]
AppId={{7EED6191-0CC5-4D95-B28B-D5AB92F09685}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\Cobiax\{#MyAppName}
DisableDirPage=yes
UsePreviousAppDir=yes
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultGroupName={#MyAppName}
InfoAfterFile=C:\Cobiax\Sorgenti\Cobiax Plan\info.txt
OutputBaseFilename=CobiaxPlan v1.0
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
[UninstallDelete]
Type: filesandordirs; Name: "C:\Cobiax\"
[Files]
Source: C:\Cobiax\Sorgenti\OpenDCL.Runtime.8.0.1.0.msi; \
DestDir: C:\Cobiax\Cobiax Plan\; Flags: deleteafterinstall
[Run]
Filename: msiexec.exe; Parameters: /i {app}\OpenDCL.Runtime.8.0.1.0.msi
[UninstallRun]
Filename: msiexec.exe; Parameters: /x {app}\OpenDCL.Runtime.8.0.1.0.msi
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Thank you very much, Dennis
Ps. Is it possible to hide that splash screen?
You have different paths to OpenDCL.Runtime.8.0.1.0.msi in [Files] and [Run] section. You install the package to a fixed path C:\Cobiax\Cobiax Plan, while you run it from a user-defined installation path {app}. As the file is temporary, you probably want to install and run it from {tmp}.
In any case, both paths probably contain a space (Cobiax Plan or Program Files). So you run
msiexec.exe /i C:\Program Files\MyAppName\OpenDCL.Runtime.8.0.1.0.msi
That's wrong. That's why you get the msiexec usage screen.
If the path contains a space, it needs to be enclosed to quotes:
msiexec.exe /i "C:\Program Files\MyAppName\OpenDCL.Runtime.8.0.1.0.msi"
The correct code would be:
[Files]
Source: C:\Cobiax\Sorgenti\OpenDCL.Runtime.8.0.1.0.msi; DestDir: {tmp}; \
Flags: deleteafterinstall
[Run]
Filename: msiexec.exe; Parameters: "/i ""{tmp}\OpenDCL.Runtime.8.0.1.0.msi"""

InnoSetup: How can you set the order of icons in the start menu?

I have the following [Icons] section in my Inno Setup script:
[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\IA_Desktop.exe"; WorkingDir: {app}
Name: "{group}\{#MyAppName}"; Filename: "{app}\IA_Desktop.exe"; WorkingDir: {app}
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}
I would expect that the order of the icons in the Start Menu -> group would be:
MyAppName
MyAppUrl
Uninstall
But instead I get:
MyAppUrl
Uninstall
MyAppName
What settings or other code do I need to use to set the order of the icons in the group?
Thanks!

Resources