powershell connects to sqlserver
来源:互联网 发布:下载桌面软件 编辑:程序博客网 时间:2024/05/01 19:34
How to issue sql query to sql server database by using powershell ?
Here is the Link : http://sev17.com/2010/07/making-a-sqlps-module/
Steps:
1) Make a module
1.1) Copy file/folder under 100/Binn to powershell/vx.0/modules/sqlps
- en
- Microsoft.SqlServer.Management.PSProvider.dll
- Microsoft.SqlServer.Management.PSSnapins.dll
- SQLProvider.Format.ps1xml
- SQLProvider.Types.ps1xml
1.2) create a file named "sqlps.psd1"
@{
ModuleVersion="0.0.0.1"Description="A Wrapper for Microsoft's SQL Server PowerShell Extensions Snapins"Author="Chad Miller"Copyright="© 2010, Chad Miller, released under the Ms-PL"CompanyName="http://sev17.com"CLRVersion="2.0"FormatsToProcess="SQLProvider.Format.ps1xml"NestedModules="Microsoft.SqlServer.Management.PSSnapins.dll","Microsoft.SqlServer.Management.PSProvider.dll"RequiredAssemblies="Microsoft.SqlServer.Smo","Microsoft.SqlServer.Dmf","Microsoft.SqlServer.SqlWmiManagement","Microsoft.SqlServer.ConnectionInfo","Microsoft.SqlServer.SmoExtended","Microsoft.SqlServer.Management.RegisteredServers","Microsoft.SqlServer.Management.Sdk.Sfc","Microsoft.SqlServer.SqlEnum","Microsoft.SqlServer.RegSvrEnum","Microsoft.SqlServer.WmiEnum","Microsoft.SqlServer.ServiceBrokerEnum","Microsoft.SqlServer.ConnectionInfoExtended","Microsoft.SqlServer.Management.Collector","Microsoft.SqlServer.Management.CollectorEnum"TypesToProcess="SQLProvider.Types.ps1xml"ScriptsToProcess="Sqlps.ps1"}
1.3) craete a file named "sqlps.ps1"
Set-Variable -scope Global -name SqlServerMaximumChildItems -Value 0Set-Variable -scope Global -name SqlServerConnectionTimeout -Value 30Set-Variable -scope Global -name SqlServerIncludeSystemObjects -Value $falseSet-Variable -scope Global -name SqlServerMaximumTabCompletion -Value 1000
2) import-module SQLPS
Now you can issues query to sql server by using invoke-sqlcmd -query xxxx -database xxxx -serverinstance xxxx
- powershell connects to sqlserver
- Python connects to MongDB
- Powershell连接操作SQLSERVER
- secure CRT can't connects to Ubuntu and Ubuntu can't connets to Internet
- powershell Hashtable to arraylist
- Say Hello to PowerShell
- 34.A user, who is authenticated externally, logs in to a remote machine and connects to the database
- Backup SQLServer 2008 DataBase using PowerShell
- Get Tables of SQLServer in PowerShell
- PowerShell 查看SqlServer默认实例密钥/序列号
- An Introduction to PowerShell Modules
- PowerShell 学习_Part1_Introduction to Toolmaking
- java connects weblogic jms
- Need to know PowerShell in SP2010
- How to format DateTime in PowerShell window
- how to get remote fqdn by powershell?
- How to write comment in PowerShell Script
- Using PowerShell to check the stock information
- 算法导论 习题 10.3
- php socket
- oracle安装过程中图像界面启动问题(xdmcp)
- PYTHON MYSQL
- Unity Android 内置付费 相关。。。
- powershell connects to sqlserver
- SQL获取插入数据的ID
- Rank() OVER(PARTITION BY)
- .Net发布到IIS服务器,IIS服务器配置
- JAVA实现DES加密 .
- Axis2框架
- 职业规划系列-性格篇:怎样选择适合自己个性的职业?
- 纯C实现c++类
- 树形DP——POJ1947 and POJ2486