大网数据广告活动
安装更新与部署

Using a Custom Action to Create User Accounts on a Local Computer

· 52CE 我爱测

This sample demonstrates how to use custom actions to create user accounts on a local computer when installing a component.

This sample demonstrates how to use custom actions to create user accounts on a local computer when installing a component. Removal of a component removes the local user accounts created by the custom action. Several custom actions are demonstrated including Deferred Execution Custom Actions and Rollback Custom Actions.

The sample meets the following specifications.

  • The installation creates user accounts only if running Windows 2000.
  • The installation creates user accounts only if the component is being installed to run locally. This precludes creating user accounts during the repair or reinstallation of the component.
  • The Installer removes the accounts when the component is removed.
  • User account information is read from a custom table in the installation database and is not hard-coded into the custom action code.
  • Because the creation or removal of user accounts requires elevated privileges, some of the custom actions must be capable of making changes to the system that require elevated privileges. These custom actions must be deferred custom actions that run when in the execution script.
  • Each account has a rollback custom action to ensure the account is removed on rollback of the component installation. This does not include the rollback of an account deletion during the removal of a component.
  • Custom actions send ActionData messages for each account that is created or removed. This does not include providing progress messages for the ProgressBar.
  • Custom actions report an error if an account cannot be created.
  • The password for the account is obtained through the user interaction with the user interface, or in the case of an installation at the Basic UI or None User Interface Levels, as a property passed on the command line.
  • Sensitive data is hidden from the log file.

The sample includes a hypothetical component named TestAccount. The discussion in the following sections assumes that you have already created the resources required by TestAccount and have authored the Feature, Component, File, Directory, and FeatureComponents tables in the sample database required to install this component. For more information, see An Installation Example.

The following topics contain information about how to create required custom actions and add them to an installation package.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。