Managing Client Network Protocols with WMI Provider
来源:互联网 发布:mac air演讲者模式 编辑:程序博客网 时间:2024/05/21 10:31
The ClientNetworkProtocol class represents the objects for client network protocols. To see the list of protocols of ClientNetworkProtocol class:
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocol | Select-Object ProtocolName, ProtocolDisplayName,ProtocolOrder
To see all the methods you can apply to the client network protocol instances:
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocol | Get-Member -memberType Method | Select-Object Name
To disable the Named Pipes protocol:
$clientprotocol=Get-WmiObject –namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocol -filter "ProtocolName='np'"
$clientprotocol.SetDisable()
To verify the result:
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocol | Select-Object ProtocolName, ProtocolDisplayName,ProtocolOrder
If you’d like to re-enable the Named Pipes protocol and place it above the TCP/IP protocol, which has an order of 2 in the list, you can simply use the SetOrderValue method toset the order of the Named Pipes protocol to 2, to take the place of the TCP/IP protocol:
$clientprotocol=Get-WmiObject –namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocol -filter "ProtocolName=’np’"
$clientprotocol.SetOrderValue(2)
To verify the result, sort all the client network protocols by their order:
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocol | Select-Object ProtocolName, ProtocolDisplayName,ProtocolOrder | Sort-Object ProtocolOrder
To get the property names and their associated protocol names of ClientNetworkProtocolProperty:
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocolProperty | Select-Object PropertyName, ProtocolName
To change the default port of the TCP/IP protocol from 1433 to 7001:
$strComputer = "."
$protocolproperty=Get-WmiObject –computerName $strComputer –namespace root\Microsoft\SqlServer\ComputerManagement10 –class ClientNetworkProtocolProperty -filter "PropertyName=’Default Port’"
$protocolproperty.SetNumericalValue(7001)
To verify the result:
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ClientNetworkProtocolProperty -filter "PropertyName=’Default Port’"
The complete script(ChangeTCPIPDefaultPort.ps1):
$wmi=Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ServerNetworkProtocolProperty `
-filter "PropertyName='TcpPort' and IPAddressName='IPAll' and InstanceName='MSSQLSERVER'?
$wmi.SetStringValue(7001) | Out-Null
$sqlservice = Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class SqlService `
-filter "ServiceName='MSSQLSERVER'"
$sqlservice.StopService() | Out-Null
$sqlservice.StartService() | Out-Null
# Confirm the default port number has been changed
Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class ServerNetworkProtocolProperty `
-filter "PropertyName='TcpPort' and IPAddressName='IPAll' and InstanceName='MSSQLSERVER'" | Select-Object PropertyStrVal
- Managing Client Network Protocols with WMI Provider
- Managing Server Network Protocols with WMI Provider
- Managing SQL Server Client Aliases with WMI Provider
- Managing SQL Server Services with WMI Provider
- Managing Windows with WMI
- 5.2. Application Layer Protocols with Embedded Network Information
- Changing SQL Server Advanced Properties with WMI Provider
- Network layers and protocols
- EZVPN client/network mode with backup gatway
- 安装 DNS WMI Provider
- Managing Network Usage
- Managing Network Usage
- Managing Network Usage
- TCP/IP Network Layer Protocols
- Managing Access with CVS
- WMI Provider for Server Events
- Performing Network Operations - Managing Network Usage
- Neutron provider external network
- SOUND SERVICE系统音效服务+震动功能实现
- object-c学习:类别Category
- lcd fb参数如何计算
- Dell Fn键 F1-F12特殊功能键
- 编程规范之--头文件
- Managing Client Network Protocols with WMI Provider
- oracle查看当前登陆的用户信息
- java学习笔记(七)
- 常用到的Intent的URI
- qte移植笔记
- H - River Hopscotch解题报告(张浩盛伦)
- IOS开发之UIKeyboardType类型
- SpringMVC框架学习
- Java中的Serializable的接口(序列化与反序列化)