码迷,mamicode.com
首页 > 数据库 > 详细

Powershell运行Invoke-Sqlcmd命令的先决条件

时间:2017-06-20 16:24:46      阅读:1132      评论:0      收藏:0      [点我收藏+]

标签:form   com   条件   http   family   hid   ted   before   rip   

运行Invoke-Sqlcmd命令,使用这个命令需满足如下条件:

 

1、在运行服务器中安装SQL Server 2008 R2 Management ObjectsI

2、在运行命令 invoke-sqlcmd 前执行如下语句.
 

技术分享
1  Add-PSSnapin SqlServerCmdletSnapin100
2   Add-PSSnapin SqlServerProviderSnapin100
View Code

 

参考原文内容:

Since all of the steps I required weren‘t listed in one place, I thought I‘d list them here in case it helps anyone:

  1. Install SQL Server 2008 R2 Management Objects using Web PI (I‘m not sure about versions prior to 2008 R2... if you have more info, please let us know in the comments)
  2. Install ‘Windows PowerShell Extensions for SQL Server‘ from the Microsoft? SQL Server? 2008 R2 Feature Pack page (it‘s about halfway down the page). Make sure you pick the correct flavor for your instance (32 or 64 bit).
  3. Run these two commands before calling invoke-sqlcmd in your script:
    Add-PSSnapin SqlServerCmdletSnapin100
    Add-PSSnapin SqlServerProviderSnapin100

参考文章:<http://www.jasonq.com/blog/2012/3-things-to-do-if-invoke-sqlcmd-is-not-recognized-in-windows-powershell

 

Powershell运行Invoke-Sqlcmd命令的先决条件

标签:form   com   条件   http   family   hid   ted   before   rip   

原文地址:http://www.cnblogs.com/scentpath/p/InvokeSqlcmd.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!