更改MS SQL报告服务帐户内置的"网络服务与QUOT; [英] Change MS SQL Reporting service account to built-in "Network Service"

查看:272
本文介绍了更改MS SQL报告服务帐户内置的"网络服务与QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我刚刚安装MS SQL Server 2012的前preSS,那么我Reporting Services配置管理器的服务帐户页面的状态的的使用内置帐户而是另一个账户(以及所使用的帐户 NT服务\\的ReportServer $< MyServerName> )。我的安装脚本指出,我需要这种改变如下图的情况。

When I have just installed MS SQL Server 2012 Express, then the Reporting Services Configuration Manager's "Service Account" page states that I'm not using a "built-in account" but rather "another account" (and that the used account is NT Service\ReportServer$<MyServerName>). My installation script states that I need to change this to the situation pictured below.

如果我的手动的打开Reporting Services配置管理器GUI并选择内置选项,然后关闭并重新打开它,该选项仍设置。但是,如果我使用PowerShell来调用 SetServiceAccount()(从 Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer.Service )来设置特定的账户,然后使用另一个账户选项保持在GUI设置。这就是我想要的躲避什么

If I manually open the Reporting Services Configuration Manager GUI and select the "Built-in" option, then close and re-open it, that option is still set. However, if I use Powershell to call SetServiceAccount() (from Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer.Service) to set a specific account, then the "Use another account" option remains set in the GUI. This is what I want to avoid.

挑战:如何以编程方式(通过PowerShell或东西我可以从PS呼叫)切换这个选项(以及指定特定帐户,除非我可以依靠网络服务是默认值)

The challenge: How can I programmatically (via Powershell, or something I can call from PS) toggle this option (as well as specify a given account, unless I can rely on "Network Service" being the default)?

MS

推荐答案

因此​​,原来居然有一些非常简单的code做到这一点。我的同事发现,由奥术魔法,我不知道。

So it turns out there is actually some very simple code to do this. My coworker found it, by which arcane magic I do not know.

这里的code:

# Init
$ns = "root\Microsoft\SqlServer\ReportServer\RS_$sqlInstanceName\v11\Admin"
$RSObject = Get-WmiObject -class "MSReportServer_ConfigurationSetting" -namespace "$ns"
# Set service account
$builtInServiceAccount = "Builtin\NetworkService"
$useBuiltInServiceAccount = $true
$RSObject.SetWindowsServiceIdentity($useBuiltInServiceAccount, $builtInServiceAccount, "") | out-null
# Set virtual directory URLs
$HTTPport = 80
$RSObject.RemoveURL("ReportServerWebService", "http://+:$HTTPport", 1033) | out-null
$RSObject.RemoveURL("ReportManager", "http://+:$HTTPport", 1033) | out-null
$RSObject.SetVirtualDirectory("ReportServerWebService", "ReportServer", 1033) | out-null
$RSObject.SetVirtualDirectory("ReportManager", "Reports", 1033) | out-null
$RSObject.ReserveURL("ReportServerWebService", "http://+:$HTTPport", 1033) | out-null
$RSObject.ReserveURL("ReportManager", "http://+:$HTTPport", 1033) | out-null
# Restart service
$serviceName = $RSObject.ServiceName
Restart-Service -Name $serviceName -Force

全部完成。很简单。我真的不想去想我已经多少我生命中的心跳浪费了这一点。

All done. So simple. I really don't want to think about how many heartbeats of my life I've wasted on this.

这篇关于更改MS SQL报告服务帐户内置的&QUOT;网络服务与QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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