`
hcmfys
  • 浏览: 357658 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

How to configure Office applications to run under the interactive user account

    博客分类:
  • c#
阅读更多
We do not recommend or support Automation to a Microsoft Office application from an unattended user account. For more information about why we do not recommend Automation in this context, click the following article number to view the article in the Microsoft Knowledge Base:
257757  (http://support.microsoft.com/kb/257757/ ) Considerations for server-side Automation of Office
If there is no choice but to automate Office from an unattended user account, use the steps in this article to configure the computer to run the Office application as the interactive user.
Back to the top
MORE INFORMATION
Caution Automation of any Office application from an unattended, non-interactive...
Caution Automation of any Office application from an unattended, non-interactive user account is risky and unstable. A single error in code or configuration can result in a dialog box that can cause the client process to stop responding (hang), that can corrupt data, or that can even crash the calling process (which can bring down your Web server if the client is ASP).

Warning Office was not designed, and is not safe, for unattended execution on a server. Developers who use Office in this manner do so at their own risk.

Regardless, it may absolutely required to use Office in this manner. In these cases, special configuration must be done to avoid errors on Office startup. The steps in this article demonstrate how to configure Office to run as the interactive user account when it is started for Automation.

When you automate under the interactive user account, you should be aware of the following problems:

    * Normally, the Interactive User is defined as the the user that is logged on to the local console (that is, the user who is physically at the computer). On computers that use Microsoft Windows 2000 Terminal Services or Microsoft Windows XP Terminal Services, the Interactive User is defined as a user who is logged on to the local console or a user who is connected to the computer through a remote Terminal Server client.
    * When it is started through automation, the Office application always runs under the security context of the user that is doing the automation. If the user is logged on to the server locally, the application runs under that user context. If a user is connected through a Terminal Server session, the application runs under that user account.

      Note If you have multiple Terminal Server connections, the application runs under the context of each user who is logged on.
    * When the Office application is started from a user context that does not have interactive privileges (such as the SYSTEM account), a user must be logged on to the server at the local console, regardless of whether Terminal Services is being used, otherwise an error occurs and the application does not start.

The following table shows some scenarios you may experience when an Office application is configured to run as the Interactive User:
Collapse this tableExpand this table
Programming action Logged on at local console? Results
Programmatically create an instance of the application from a user session logged on the machine remotely through a Terminal Server Client Yes Success: The application starts under the desktop of the local or remote user that is running the Automation code.
No Success: The application starts under the desktop of the remote user that is running the Automation code.
Programmatically create an instance of the application from an account with a non-interactive SID (ASP, Service, etc.) Yes Success: The application starts under the desktop of the user that is logged on locally (the user that is physically at the machine).
No Error: 0x8000401A - CO_E_RUNAS_LOGON_FAILURE The server process could not be started because the configured identity is incorrect. Check the username and password.
Programmatically create an instance of the application from an MTS/COM+ package that is configured to run as INTERACTIVE Yes Success: The application starts under the desktop of the user that is logged on locally. Terminal Server sessions are not "interactive" in this case.
No Error: 0x8000401A - CO_E_RUNAS_LOGON_FAILURE The server process could not be started because the configured identity is incorrect. Check the username and password.
Programmatically create an instance of the application from an MTS/COM+ package that is configured to run as a specific user Yes Success: The application starts under the desktop of the user that is logged on locally, and not the specific user account for the package.
No Error: 0x8000401A - CO_E_RUNAS_LOGON_FAILURE The server process could not be started because the configured identity is incorrect. Check the username and password.
Because the changes in DCOM are global, configuring Office in this manner can have negative side effects for other clients on the system that use Office. It is possible that another client application will not be able to use the Office application after the settings are made. Consider carefully what impact this has to your server before you make any changes to the DCOM configuration settings.

If the problems listed here are too great for your design, or cause other unidentified problems, it is possible to configure Office differently and still allow it to start from an unattended process or service. For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
288367  (http://support.microsoft.com/kb/288367/ ) How to configure Office applications to run under a specific user account
288368  (http://support.microsoft.com/kb/288368/ ) How to configure Office applications for automation from a COM+/MTS package
Configuring Office as the interactive user
To set up an Office Automation server under the interactive user account, follow these steps:

   1. Log on to the computer as the Administrator and install (or reinstall) Office using a complete install. For system robustness, it is recommended that you copy the contents of the Office CD-ROM to a local drive and install Office from this location.
   2. Start the Office application that you intend to automate. This forces the application to register itself.
   3. After the application is running, press ALT+F11 to load the Microsoft Visual Basic for Applications (VBA) editor. This forces VBA to initialize itself.
   4. Close the applications, including VBA.
   5. Click Start, click Run, and then type DCOMCNFG. Select the application that you want to automate. The application names are listed in the following table.
      Collapse this tableExpand this table
      Office program Application name
      Microsoft Access 97 Microsoft Access Database
      Microsoft Access 2000/2002 Microsoft Access Application
      Microsoft Office Access 2003 Microsoft Access Application
      Microsoft Office Access 2007 Microsoft Office Access Application
      Microsoft Excel 97/2000/2002 Microsoft Excel Application
      Microsoft Office Excel 2003 Microsoft Excel Application
      Microsoft Office Excel 2007 Microsoft Excel Application
      Microsoft Word 97 Microsoft Word Basic
      Microsoft Word 2000/2002 Microsoft Word Document
      Microsoft Office Word 2003 Microsoft Word Document
      Microsoft Office Word 2007 Microsoft Office Word 97 - 2003 Document
      Click Properties to open the property dialog box for this application.
   6. Click the Security tab. Verify that Use Default Access Permissions and Use Default Launch Permissions are selected.
   7. Click the Identity tab and then select The Interactive User.
   8. Click OK to close the property dialog box and return to the main applications list dialog box.
   9. In the DCOM Configuration dialog box, click the Default Security tab.
  10. Click Edit Defaults for access permissions. Verify that the following users are listed in the access permissions, or add the users if they are not listed:
          * SYSTEM
          * INTERACTIVE
          * Everyone
          * Administrators
          * IUSR_machinename (See note)
          * IWAM_machinename (See note)
      Note These accounts only exist if Internet Information Server (IIS) is installed on the computer.
  11. Make sure that each user is allowed access and click OK.
  12. Click Edit Defaults for launch permissions. Verify that the following users are listed in the launch permissions, or add the users if they are not listed:
          * INTERACTIVE
          * Everyone
          * Administrators
          * IUSR_machinename (See note)
          * IWAM_machinename (See note)
      Note These accounts exist only if IIS is installed on the computer.
  13. Make sure that each user is allowed access, and then click OK.
  14. Click OK to close DCOMCNFG.
  15. Start Registry editor and verify that the following keys and string values exist for the Office application that you want to automate:
      Microsoft Office Access 2003/2007:
      Key: HKEY_CLASSES_ROOT\AppID\MSACCESS.EXE
      AppID: {73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9}

      Microsoft Access 2000/2002:
      Key: HKEY_CLASSES_ROOT\AppID\MSACCESS.EXE
      AppID: {73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9}

      Microsoft Access 97:
      Key: HKEY_CLASSES_ROOT\AppID\MSACCESS.EXE
      AppID: {8CC49940-3146-11CF-97A1-00AA00424A9F}

      Microsoft Office Excel 2003/2007:
      Key: HKEY_CLASSES_ROOT\AppID\EXCEL.EXE
      AppID: {00020830-0000-0000-C000-000000000046}

      Microsoft Excel 97/2000/2002:
      Key: HKEY_CLASSES_ROOT\AppID\EXCEL.EXE
      AppID: {00020812-0000-0000-C000-000000000046}

      Microsoft Office Word 2003/2007:
      Key: HKEY_CLASSES_ROOT\AppID\WINWORD.EXE
      AppID: {C184E717-402A-438F-B99E-77C2CD4091C8}

      Microsoft Word 97/2000/2002:
      Key: HKEY_CLASSES_ROOT\AppID\WINWORD.EXE
      AppID: {00020906-0000-0000-C000-000000000046}
      If these keys do not exist, you can create them by running a .reg file on your computer that resembles the following .reg file:

      REGEDIT4

      [HKEY_CLASSES_ROOT\AppID\WINWORD.EXE]
      "AppID"="{00020906-0000-0000-C000-000000000046}"

      [HKEY_CLASSES_ROOT\AppID\EXCEL.EXE]
      "AppID"="{00020812-0000-0000-C000-000000000046}"

      [HKEY_CLASSES_ROOT\AppID\MSACCESS.EXE]
      "AppID"="{73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9}"
     

      Note The sample .reg file is for Access 2000 or Access 2002. If you are using Access 97, change the AppID key to:

      "AppID"="{8CC49940-3146-11CF-97A1-00AA00424A9F}"

  16. Restart the system. This is required.

Back to the top
REFERENCES
For more information, click the following article numbers to view the articles...
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
169321  (http://support.microsoft.com/kb/169321/ ) COM servers activation and NT Windows stations
184291  (http://support.microsoft.com/kb/184291/ ) COM objects fail to print when called from ASP
Back to the top
APPLIES TO

    * Microsoft Office Access 2007
    * Microsoft Office Access 2003
    * Microsoft Access 2002 Standard Edition
    * Microsoft Access 2000 Standard Edition
    * Microsoft Access 97 Standard Edition
    * Microsoft Office Excel 2007
    * Microsoft Office Excel 2003
    * Microsoft Excel 2002 Standard Edition
    * Microsoft Excel 2000 Standard Edition
    * Microsoft Excel 97 Standard Edition
    * Microsoft Office Word 2007
    * Microsoft Word 2002
    * Microsoft Word 2000
    * Microsoft Word 97 Standard Edition
分享到:
评论

相关推荐

    How to Configure User Status in mySAP SRM.pdf

    本文档主要介绍了如何在mySAP Supplier Relationship Management (SRM)系统中配置用户状态(User Status)。mySAP SRM是一款用于管理供应商关系的企业级软件,它通过自动化采购流程、提供供应链透明度等手段帮助组织...

    How to configure DCM UDS with the DEXT Editor.pdf

    How to configure DCM UDS with the DEXT Editor.pdf

    How to configure ODBC DSN to access local DB2 for Windows

    This article introduces how to configure ODBC DSN in Server to access local DB2 for windows in detail. Then I give a sample how to access local DB2 database with ODBC by DB Query Analyzer expediently.

    How to configure ODBC DSN in Client to access DB2 for Windows.

    This article introduces how to configure ODBC DSN in Client to access remote DB2 for windows in detail. Then I give a sample how to access remote DB2 database with ODBC by DB Query Analyzer ...

    How to Configure Odoo 13 on Pycharm Ubuntu 18(1).mp4

    How to Configure Odoo 13 on Pycharm Ubuntu 18 ubuntu18下安装ODOO13 pycharm配置ODOO13开发环境

    How to Configure the Watchdog BSW Stack's Supervision.pdf

    这份文档是一份全面的技术指南,用于指导用户如何在RTA-BSW中配置看门狗(Watchdog)的监控功能。看门狗是一种安全机制,用于确保汽车电子控制单元(ECU)中软件组件的正确运行。文档涵盖了从基础概念到具体配置步骤...

    Beginning Spring Boot 2 Applications and Microservices with the Spring Framework

    usually multiple ways to configure the application. Although it is a good thing to have multiple options, it can be overwhelming to the beginners. Spring Boot addresses this “Spring applications need...

    Getting Started with Grunt: The JavaScript Task Runner

    Learn how to install, configure, run, and customize Grunt Example-driven and filled with tips to help you create custom Grunt tasks In Detail In recent times, modern web browsers have become the ...

    JBoss AS 5 Performance Tuning.pdf

    Preface JBoss AS 5 Performance Tuning will teach you how to deliver fast applications on ...to configure and develop web applications that get the most out of the embedded Tomcat web server.

    UE(官方下载)

    We'll look at how to create, edit, and configure bookmarks in the bookmark viewer. Creating Search Favorites UltraEdit includes a Search and Replace Favorites feature that allows you to manage ...

    OPC UA 客户端 服务器 标准库源码

    This section describes how to run the NetCoreConsoleClient, NetCoreConsolePublisher and NetCoreConsoleServer sample applications. Please follow instructions in this article to setup the dotnet command...

    AUTOSAR XCP详细配置流程 How to configure XCP

    这份应用说明文档提供了在 RTA-CAR 9.1.0 VRTA Starter Kit 上配置 XCP(测量和校准协议)的详细步骤。XCP 配置涉及对 DBC 和 DBF 文件的更新,ECU 配置的更新,XCP BSW 模块的配置,BswM 动作列表的初始化,SWC 的...

    Configure the user profile service in SharePoint 2010

    在SharePoint 2010中配置用户配置文件服务是一项至关重要的任务,它涉及到一系列步骤,以确保系统能够正确地同步、管理和显示用户信息。在安装SharePoint Server 2010后,需要手动完成一些配置工作,其中就包括启用...

    google api php client

    1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject: ```php $...

    VMware vSphere 6.5 Cookbook 3rd Edition.pdf

    Chapter 5, Using vSphere Auto Deploy, you will learn how to deploy stateless and stateful ESXi host without the need to have to run the ISO installation on the server hardware. Chapter 6, Using ...

    Mastering Ubuntu Server(PACKT,2016)

    To virtualize hosts and applications, you will be shown how to set up KVM/Qemu and Docker and manage virtual machines with virt-manager. Lastly, you will explore best practices and troubleshooting ...

    Configure RTX v5.pdf

    Thread Configuration provides several parameters to configure the Thread Management functions. Timer Configuration provides several parameters to configure the Timer Management functions. Event ...

    Microsoft Azure IaaS Essentials(PACKT,2015)

    Moving forward, you will learn how to configure your virtual machine to ensure it continues to function in the event of a disaster. With plenty of screenshots offering a play-by-play account of how ...

    Getting Started with Grunt(PACKT,2014)

    You will quickly learn how to install, configure, and run Grunt. You will go on to understand how to use third-party Grunt and then create your own Grunt tasks that cater to your particular needs.

Global site tag (gtag.js) - Google Analytics