亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

使用powershell 設置 sql server 協議

系統 2114 0

Configuring SQL Protocols through Windows PowerShell

Sometimes we are asked about the possibility of configuring SQL Server protocols through PowerShell. ?? In SQL Server 2008, the sqlps tool incorporates WMI and SMO into this powerful Windows administrator tool, making it easy to manage SQL Server protocols through PowerShell.

???????????????? To get started, run (elevated, if on Windows Vista or Windows Server 2008) sqlps.exe, which by default is located at the %ProgramFiles%\Microsoft SQL Server\100\Tools\binn\sqlps.exe; or, if your architecture is x64, it is in the same path as above, under your Program Files (x86) directory.

???????????????? Now that you have an Admin SQL PowerShell window, here are some example scripts that you can run to configure your SQL Server instance:

Get the TCP, NP, and SM objects

This script is the starting point for manipulating the protocols properties on a local default instance.? ? To modify this for a named instance, replace “MSSQLSERVER” with the name of your instance.

$MachineObject = new-object ('Microsoft.SqlServer.Management.Smo.WMI.ManagedComputer') .

$ProtocolUri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol"

?

$tcp = $MachineObject.getsmoobject($ProtocolUri + "[@Name='Tcp']")

$np = $MachineObject.getsmoobject($ProtocolUri + "[@Name='Np']")

$sm = $MachineObject.getsmoobject($ProtocolUri + "[@Name='Sm']")

?

Enable remote connection protocols

Once you have the base protocol objects, enabling remote connections is trivial:

$np.IsEnabled = $true

$np.alter()

$tcp.IsEnabled = $true

$tcp.alter()

Calling the .alter() method commits changes you make to the registry, and you will need to restart the SQL Server instance for it to pick up these changes.

More elaborate example: Modifying an instance’s TCP Port

Once you have the TCP object, you can view the properties of the TCP Ports on the various IP Addresses your SQL Server instance is listening on. ?? For instance, this command will show the properties of the “IPAll” IP Address:

$MachineObject.getsmoobject($tcp.urn.value + "/IPAddress[@Name='IPAll']")

The following commands will make your server listen on the TCP port 3344, by modifying the TcpPort property of the IPAll entry and then committing those changes:

$MachineObject.getsmoobject($tcp.urn.Value + "/IPAddress[@Name='IPAll']").IPAddressProperties[1].Value = "3344"

$tcp.alter()

You can now verify in the SQL Server Configuration Manager that your IPAll setting is now set to listen on TCP Port 3344, and restarting the SQL Server service will result in it now listening on the newly-specified port

使用powershell 設置 sql server 協議


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 欧美xxxx成人免费视频 | 久久视频精品36线视频在线观看 | 中文字幕在线视频不卡 | 久草精品免费 | 色a4yy| 成人欧美一区二区三区在线 | 国产一区二区免费播放 | 国产欧美成人免费观看视频 | 摸逼综合网 | 欧美亚洲高清日韩成人 | 国产亚洲精品精品国产亚洲综合 | 奇米影视奇米色777欧美 | 国产精品一区二区三区四区五区 | 欧美另类高清xxxxx | 久久婷婷丁香七月色综合 | 国产第一区二区三区在线观看 | 美女久久久久久 | 曰韩毛片| 久久精品最新免费国产成人 | 羞羞视频免费观看网站 | 男人的私人影院 | 黄色不良视频 | 成人国产精品免费视频不卡 | 2021最新国产成人精品视频 | 久久精品乱子伦免费 | 一级成人| 久久草在线视频免费 | 九九精品影院 | 欧美一级网 | 伊人五月天婷婷琪琪综合 | 91精品国产91久久久久福利 | 免费中文字幕一级毛片 | 国产精品欧美一区二区三区 | 天天色综合图片 | 男女啪啪网站 | 日本不卡一区二区三区 最新 | 国产精品视频不卡 | 国产精品主播在线 | 日本一级在线观看 | 久久国产精品麻豆映画 | 老子午夜伦不卡影院 |