如何使设置适用于受限(非管理员)用户 [英] How to make a setup work for limited (non-admin) users

查看:169
本文介绍了如何使设置适用于受限(非管理员)用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Visual Studio 2008(SP1)为Office 2007外接程序制作了一个Visual Studio安装项目.安装程序仅将文件复制到每个用户的位置(LocalAppData),并且仅将注册表设置写入HKEY_CURRENT_USER,但是在Windows 7下运行时,MSI在开始复制文件之前会要求管理员凭据.在Windows XP上,该安装程序可以在受限用户帐户下正常运行,但是在Windows 7下,似乎需要管理员权限.

我一直无法找到一种方法来删除管理员提升要求,并且我想知道如何执行此操作,或者是否无法使用Visual Studio安装项目来执行此操作.

更新2010-11-03(更多详细信息)

当我构建Visual Studio安装项目时,它会创建一个setup.exe和一个MSI文件. Visual Studio 2008似乎对我如何创建setup.exe或如何创建MSI文件没有给予足够的控制. setup.exe文件似乎仅用于安装Office 2007 AddIn可能需要的所有必备组件. MSI文件可以独立运行,可以安装实际的Office 2007加载项.我想学习如何标记MSI文件,以使其不要求管理员特权,因为我的MSI文件仅将文件复制到每个用户位置,并且仅将注册表设置写入HKEY_CURRENT_USER.

解决方案

我相信我已经在此页面上找到了答案:

http://blogs.msdn.com /b/rflaming/archive/2006/09/30/778690.aspx


如何构建标准用户软件包?

需要花一些时间才能将软件包安装到标准用户所允许的位置.某些要求是

  1. 在InstallUISequence中使用Type 51自定义操作始终取消设置ALLUSERS(每个用户的选项)

  2. 文件只能写到标准用户有权访问的文件夹中.假设ALLUSERS始终设置为每个用户设置,则可以使用可重定向文件夹属性,但不能使用ProgramFilesFolder,因为它不会在每个用户上重定向.

  3. 将应用程序安装到LocalAppDataFolder下的位置.

  4. 所有注册表设置都应写入注册表表根"列中的HKCU(即1).

  5. 将摘要信息流中单词计数属性的第3位翻转以表明不需要凭据提示.

  6. 如果您具有引导程序(通常名为setup.exe),则将被请求的ExecutionLevel声明为以Invoker身份运行.

  7. 通过ICE验证,因为ICE可以检查每个用户和每个计算机的状态是否正确混合.

  8. 从标准用户帐户和提升的命令提示符下进行测试,以确认行为.

  9. 为用户提供有关软件包用户特定性质的文档,因为这在当今的应用程序安装中并不常见.


注意:可以使用Microsoft的MSI编辑工具Orca完成第5步.在Orca中打开MSI文件,选择查看"->摘要信息...",然后选中符合UAC"复选框.

注意#2:步骤5可以使用Microsoft SDK中包含的WiSumInf.vbs示例脚本文件完成:C:\ Program Files \ Microsoft SDKs \ Windows \ v7.0 \ Samples \ sysmgmt \ msi \ scripts \ WiSumInf .vbs

注意#3:在Visual Studio Step Project中,似乎可以通过右键单击安装项目,选择View-> User Interface,获取"Install/Start/Installation Folder"的属性来完成步骤1.页并将"InstallAllUsersVisible"设置为False.

注释#4:执行步骤5的另一种方法,请使用用于Windows Installer开发人员的Windows SDK组件"中包含的MsiInfo.exe工具. us/library/aa370310(VS.85).aspx"rel =" nofollow noreferrer> http://msdn.microsoft.com/zh-cn/library/aa370310(VS.85).aspx

注释4的补充:假设您使用长文件名和压缩媒体(MSI的默认行为),则 PostBuildEvent 命令将类似于:

"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\MsiInfo.exe" "$(BuiltOuputPath)" /w 10

请注意,您必须更改MsiInfo的路径以匹配系统中的MsiInfo.

I've made a Visual Studio Setup Project with Visual Studio 2008 (SP1) for an Office 2007 AddIn. The setup only copies files to a per-user location (LocalAppData) and only writes registry settings to HKEY_CURRENT_USER, but when run under Windows 7, the MSI asks for admin credentials just before it begins copying files. The installer works perfectly running under a limited user account on Windows XP, but under Windows 7, admin privileges seem to be required.

I have not been able to find a way to remove the admin elevation requirement and I want to know how to do this or if it is not possible to do this with a Visual Studio Setup Project.

UPDATE 2010-11-03 (more details)

When I build the Visual Studio Setup Project, it creates a setup.exe and an MSI file. Visual Studio 2008 does not seem to give me adequate control over how the setup.exe is created or how the MSI file is created. The setup.exe file seems to be only for installing any prerequisites that my Office 2007 AddIn may need. It is the MSI file, which can be run independently, that installs the actual Office 2007 AddIn. I want to learn how to mark the MSI file such that it does not ask for admin privileges, because my MSI file only copies files to a per-user location and only writes registry settings to HKEY_CURRENT_USER.

解决方案

I believe I have found the answer on this page:

http://blogs.msdn.com/b/rflaming/archive/2006/09/30/778690.aspx


How do I build a Standard User package?

This takes a bit of work to make a package install only to the locations a Standard User has permission. Some of the requirements are

  1. Use a Type 51 Custom Action in the InstallUISequence to always unset the ALLUSERS (the per-user option)

  2. Files must be written only to folders that Standard User has access to. Assuming the ALLUSERS is always set to the per-user setting, you can use the redirectable folder properties but not ProgramFilesFolder as it does not redirect on per-user.

  3. Install app to a location under LocalAppDataFolder.

  4. All registry settings should be written to HKCU which is 1 in the Registry Table’s Root column.

  5. Flip bit 3 of the word count property in the summary information stream to signal no credential prompt is required.

  6. If you have a bootstrapper (typically named setup.exe), manifest the requestedExecutionLevel to run asInvoker.

  7. Pass ICE Validation as the ICEs have checks for incorrectly mixing per-user and per-machine state.

  8. Test both from a Standard User account and from an elevated command prompt to confirm behavior.

  9. Provide your users’ documentation of the user specific nature of the package as this is atypical in today’s application installs.


NOTE: Step 5 can be done using Orca, Microsoft's MSI editing tool. Open the MSI file in Orca, select View-->Summary Information... then check the "UAC Compliant" checkbox.

NOTE #2: Step 5 can be done using the WiSumInf.vbs sample script file included in the Microsoft SDK: C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\sysmgmt\msi\scripts\WiSumInf.vbs

NOTE #3: Step 1 seems to be taken care of in a Visual Studio Step Project by right-clicking on the setup project, choosing View-->User Interface, getting properties for the "Install/Start/Installation Folder" page and setting "InstallAllUsersVisible" to False.

NOTE #4: Yet another way to do Step 5, use the MsiInfo.exe tool included in the "Windows SDK Components for Windows Installer Developers" http://msdn.microsoft.com/en-us/library/aa370310(VS.85).aspx

Addition to the NOTE #4: Assuming that you are using long file names and compressed media (default behavior for an MSI) the PostBuildEvent command would be something like:

"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\MsiInfo.exe" "$(BuiltOuputPath)" /w 10

Note that you will have to change the path to the MsiInfo to match the one that it has in your system.

这篇关于如何使设置适用于受限(非管理员)用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆