SetWindowsServiceIdentity 方法 (WMI MSReportServer_ConfigurationSetting)

讓報表伺服器 Windows 服務以指定之 Windows 使用者的身分執行,並且授與此帳戶足夠的檔案系統權限,以便允許報表伺服器運作。

語法

Public Sub SetWindowsServiceIdentity(UseBuiltInAccount as Boolean, _
    Account as String, Password as String, ByRef HRESULT as Int32)
public void SetWindowsServiceIdentity(boolean UseBuiltInAccount, 
    string Account, string Password, out Int32 HRESULT);

參數

  • UseBuiltInAccount
    指出指定的帳戶是否為內建 Windows 帳戶。

  • Account
    要用來執行 Windows 服務的 Windows 帳戶,其格式為 "DOMAIN\alias"。

  • Password
    此帳戶的密碼。

  • HRESULT
    [out] 指出呼叫成功或失敗的值。

傳回值

傳回 HRESULT,指出方法呼叫成功或失敗。值為 0 表示方法呼叫成功。非零值則表示已發生錯誤。

備註

當 UseBuiltInAccount 參數設定為 true 而且報表伺服器正在 Microsoft Windows 2000 或 Windows XP 上執行時,系統會忽略 Name、Domain 和 Password 參數的值並且使用本機系統帳戶。

當 UseBuiltInAccount 參數設定為 true 而且報表伺服器正在 Windows Server 2003 上執行時,系統就會忽略 Domain 和 Password 屬性,而且名稱欄位必須包含 “Builtin\NetworkService”、“Builtin\System” 或 “Builtin\LocalService”。

SetWindowsServiceIdentity 方法會在報表伺服器安裝目錄中設定檔案與資料夾的檔案權限。

Account 參數中指定的帳戶需要 Windows 中的 LogonAsService 權限。此方法會將這個權限授與指定的帳戶。

需求

**命名空間:**root\Microsoft\SqlServer\ReportServer\RS_<EncodedInstanceName>\v10\Admin

**平台:**Windows Server 2003 Datacenter Edition;Windows Server 2003 Enterprise Edition;Windows Server 2003 Standard Edition;Windows Vista;Windows XP Professional Service Pack 2 (SP2) 或 Service Pack 1 (SP1);或 Windows 2000 (所有版本)