如何在 InnoSetup 脚本中检测我是否在终端服务器上安装?
当程序安装在终端服务器上时,我的设置的行为应该略有不同。 我了解 GetSystemMetrics(SM_REMOTESESSION)
但据我所知,它只会告诉我是否在 RDP 会话中运行。 它不会捕获服务器管理员在本地登录以安装软件的情况,或者会吗?
检查终端服务器服务似乎也不可行,因为启用远程桌面后该服务也在工作站上运行。 我需要将其与允许多个并发登录会话的真正 TS 区分开来。
我没有检查任何其他服务或注册表项吗?
My setup should behave slightly differently when the program is installed on a Terminal Server. I know about GetSystemMetrics(SM_REMOTESESSION)
but as far as I understood that will only tell me whether I'm running inside a RDP session. It would not catch the case where the server admin is logged on locally to install software, or would it?
Checking for the Terminal Server service does not appear to be viable either as that also runs on workstations when Remote Desktop has been enabled. I need to differentiate this from a true TS that allows multiple concurrent logon sessions.
Isn't there any other service or registry key that I check for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这正是您所需要的:
检测是否安装了终端服务
请注意,除此之外,您还可以使用 GetVersion() 的值来确定您是否正在运行 NT。 如果不是 NT 则退出。
链接显示的是如果版本是Win2k以上则需要查询的代码
This is exactly what you need:
Detecting Whether Terminal Services Is Installed
Note that in addition to this you can use the value of GetVersion() to determine if you are at all running NT. If not NT then bail out.
The link shows the code you need to query if the version is Win2k or later
感谢 Magnus Skog 提供的链接,我发现 InnoSetup 已经支持
GetWindowsVersionEx
API 函数。 因此,我所要做的就是:我已经成功地针对以下场景进行了测试:
False
)True
)False
)我还没有机会在 TS 本地登录时进行测试。 当我有时会更新这篇文章。
Thanks to the link provided by Magnus Skog I discovered that InnoSetup already supports the
GetWindowsVersionEx
API function. Therefore all I had to do was this:I have successfully tested this for the following scenarios:
False
)True
)False
)I did not yet have the opportunity to test while logged on locally on a TS. Will update this post when I have.
我猜这个问题可能有很多答案,但所有这些答案似乎都有点令人不满意。
例如,可能的情况有哪些:
但是,具有 RDP 的服务器又如何呢?选项已启用,但未使用? 启用 RDP 选项的服务器怎么样,但管理员在控制台上安装您的软件,而一天中没有人通过 RDP 登录? 您将无法确定服务器是否实际在使用(RDP 方式)。
给你一个具体答案的最好方法是问为什么你需要确定这个? 如果您能够可靠地检测到这一点,您将启用或禁用哪种功能?
I'm guessing that this question has a potential for many answers, all of which will seem slightly unsatisfactory.
For instance, what are the possible scenarios:
However, what about a server that has the RDP option enabled, but it isn't used? How about a server that has the RDP option enabled, but the administrator is installing your software at the console, at a time of day when nobody is logged in through RDP? You wouldn't be able to determine if the server is actually in use, RDP-wise, or not.
The best way to give you a concrete answer is to ask why you need to determine this? What kind of functionality will you enable or disable if you were able to reliably detect this?