We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

MartinR.
Posts: 5
Joined: Wed Oct 17, 2012 9:12 am

Installing Desktop-Experience Feature as Pre-Requisite

Hello,

I'm currently trying to build an Advanced Installer for my software. My software should later be able to run on Windows Server 2008 R2 (and possibly Windows Server 2012). Unfortunately, it needs the "Desktop-Experience" Feature - so I would love to check this as a Pre-Requisite in Advanced Installer. Unfortunately (again), there is no pre-defined method of checking this, so I tried a couple of approaches:
  • Scanned the registry before and after installing Desktop-Experience (in a VM) - there are lots of changes in the registry, but none of them struck me as being a good way to check the installation status of Desktop-Experience
  • Custom Action. Running the batch-file from a custom action seems not to be possible during the initialization of the Installer, because the batch file has not yet been deployed to the target machine. Therefore, I cannot run the batch file with a "DoAction" on the PrepareDlg (which would be the latest Dialog where it would make sense IMO)
  • Custom Pre-Requisite. This has the advantage doing the check only on Windows Server machines. Unfortunately, the Check would always have to be done, but I could live with that. I wrote a batch script and called that batch script from the Pre-Requisite ("Main Setup File"). I know batch files aren't really officially supported but it works.
My batch script basically executes "ServerManagerCmd.exe -install Desktop-Experience" - and this is where my real problems started... The script returned an error-code 9009, meaning it could not find the ServerManagerCmd.exe. I was baffled, as it surely is on the machine I tested this (Windows Server 2008 R2, in a VM) in C:\Windows\System32 . So echo'ed the PATH environment variable to c:\tmp.txt and sure enough: system32 is in the PATH.
Next I told the batch script to "cd" to %WINDIR%\System32 and issued a "dir" command - surprise: ServerManagerCmd.exe is not there, however a bunch of other files and the Free-Space seemed to be correct. Other files are missing there as well, it reported only about a fifth of the actual available files. Then I renamed one of the actual files in C:\Windows\System32 (in the VM), re-ran the Installer - even bigger surprise: the "dir" command still listed the original (not-renamed) file.

So my questions would be:
1. HUH? How in the world does the Batch-Script see content in %WINDIR%\System32 that is no longer on the machine where the installer runs (because I renamed that file) ?
2. HUH? How in the world does the Batch-Script NOT see content in %WINDIR%\System32 that is actually on the machine where the installer runs (i.e. ServerManagerCmd.exe) ?
3. Actually the most important question: Does anybody have a good idea, how to check for Desktop-Experience Feature and install it if not yet availble? Preferably as a custom Pre-Requisite? Or (if checking is not possible) how to always issue an "Install Desktop-Experience" command and check the return values (e.g. from ServerManagerCmd.exe) ?

AdvancedInstaller 9.6, developing on Win7, trying to run on Windows Server 2008 R2 (in a VMware Virtual Machine)

Best regards

Martin
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Installing Desktop-Experience Feature as Pre-Requisite

Hello Martin and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.
Custom Action. Running the batch-file from a custom action seems not to be possible during the initialization of the Installer, because the batch file has not yet been deployed to the target machine. Therefore, I cannot run the batch file with a "DoAction" on the PrepareDlg (which would be the latest Dialog where it would make sense IMO)
Please keep in mind that in order to run a BAT file at the beginning of the installer setup you can add the related BAT file as temporary. You can take a look on our "Launch a CMD or BAT file" article.
1. HUH? How in the world does the Batch-Script see content in %WINDIR%\System32 that is no longer on the machine where the installer runs (because I renamed that file) ?
2. HUH? How in the world does the Batch-Script NOT see content in %WINDIR%\System32 that is actually on the machine where the installer runs (i.e. ServerManagerCmd.exe) ?
I'm not sure why you are encountering this behavior.
3. Actually the most important question: Does anybody have a good idea, how to check for Desktop-Experience Feature and install it if not yet availble? Preferably as a custom Pre-Requisite? Or (if checking is not possible) how to always issue an "Install Desktop-Experience" command and check the return values (e.g. from ServerManagerCmd.exe) ?
I'm afraid I don't know how to add the Desktop-Experience Feature as a prerequisite to your project. However, if you want to install the related feature before the deployment of your application files on target machine you can proceed like this:
- Add a BAT file (i.e. batch_file.bat), which will launch the Desktop-Experience installation, as a temporary file to your project.
- Add a "Launch File or open URL" custom action with sequence, after Wizard Dialogs Stage -> Paths Resolution" action group, like this:
  • Command: "[&batch_file.bat]"
    Execution Properties: Synchronous execution, check return code
- Build and run your project.

Let us know if this helps, otherwise please give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MartinR.
Posts: 5
Joined: Wed Oct 17, 2012 9:12 am

Re: Installing Desktop-Experience Feature as Pre-Requisite

Hi Daniel,

thanks for your comment. I had actually tried that approach before, but I've tried it again with the same result. However, I've done some more investigation and it turns out that the batch file is redirected to the SysWOW64 folder and looking for "ServerManagerCmd.exe" there - but it doesn't exist there.
I read in another forum thread that somebody else was having this issue in 2010 (32-bit batch file redirection on a 64 bit system) and it was said to be resolved in an upcoming version of AdvancedInstaller. My guess now would be, that viewer.exe still only exists as a 32-bit package and therefore all batch files executed through a custom action (or as a pre-requisite) are executed as 32-bit batch files as well, even though I'm creating a special 64-bit Installer package?
Is there any way to prevent my (attached) script (minimal demo of the issue) from doing this and running as a 64 bit script? The option "64-bit script" on the custom action is grayed out and I can't check the corresponding checkbox.

Best regards

Martin

Edit: Fixed URL to forum thread
Attachments
DesktopExperience.zip
(17.32 KiB) Downloaded 534 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Installing Desktop-Experience Feature as Pre-Requisite

Hello Martin,

In order to run your .BAT file using the 64-bit version of the viewer.exe program you should use our "Launch file or open URL using 64-bit launcher" custom action.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MartinR.
Posts: 5
Joined: Wed Oct 17, 2012 9:12 am

Re: Installing Desktop-Experience Feature as Pre-Requisite

Hello Daniel,

sorry for the late reply. I was so fixed to the check-box, that I didn't notice the 64-bit launcher, thanks for pointing it out. This works now just as desired (although a pre-requisite from AI would be even nicer *hint* *hint* :-) )

Thanks for your help!

Best regards

Martin
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Installing Desktop-Experience Feature as Pre-Requisite

You're welcome. Glad to help.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”