开发者

Check installed Windows Server Features with NSIS

开发者 https://www.devze.com 2023-03-16 01:06 出处:网络
I\'m trying to install a custom build software on Windows Server 2008R2, 2008 and 2003. The software needs the \"Desktop-Experience\" feature from Windows to be installed.

I'm trying to install a custom build software on Windows Server 2008R2, 2008 and 2003. The software needs the "Desktop-Experience" feature from Windows to be installed.

I know I can check with servermanagercmd.exe (even though it's kind of cumbersome) in 2003 and 2008 - unfortunately, this does no longer work in 2008R2 (64bit) from inside an NSIS installer - it does work if I just run the command. Called from the installer, I'm getting a "servermanagercmd.exe is not recognized as an internal or external command, operable program or batch file."-error, even if I'm setting the working directory to c:\windows\system32 (yes, on a 64 bit machine, but there's no servermanagercmd.exe in sysWOW64). Here's the line of code inside NSIS:

nsExec::ExecToStack 'servermanagercmd.exe -query | findstr "Desktop-Experience"'

In 2008R2, I thought the situation would actually improve, as PowerShell is now installed by default. However, when trying to get the information, I need to first load the ServerManager module inside PowerShell - but this module is not available for reading for Trusted Installer . So I'm facing the same situation again: If I'm running my powershell command from a command line, it works, but not from inside the NSIS installer. Again, here's the line of code inside NSIS:

nsExec::ExecToStack 'powershell.exe "& "Import-Module ServerManager"'

The three(!) (double)quotation marks are actually correct.

So, does anybody know of a way to check whether Desktop-Experience is installed (and install it if not) in Windows Server 2008R2 from inside an NSIS installer? The solu开发者_运维知识库tion does not need to work on Server2003 or 2008, because the string parsing from servermanagercmd.exe works there.


Are you using the macros in x64.nsh to turn off WOW64 redirection? (Or use "$windir\sysnative\servermanagercmd.exe")

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号