PowerShell prerequisites for running the invoke-sqlcmd command

Source: Internet
Author: User

To run the Invoke-sqlcmd command, use this command to meet the following requirements:

1. Install SQL Server R2 Management Objectsi in the running server

2. Execute the following statement before running the command invoke-sqlcmd.

1  add-pssnapin SqlServerCmdletSnapin1002   add-pssnapin SqlServerProviderSnapin100
View Code

Refer to the original content:

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

    1. install sql Server R2 Management Objects Using web pi  (I ' m not sure on versions prior to R2 ... if you had more info, please let us know in the C omments)
    2. install ' Windows PowerShell Extensions for SQL Server ' from The microsoft? SQL Server? R2 Feature Pack page (it's about halfway down the page). Make sure your pick the correct flavor for your instance (+ or-bit).
    3. run These, commands before calling Invoke-sqlcmd In your script:
      Add-pssnapin SqlServerCmdletSnapin100
      Add-pssnapin SqlServerProviderSnapin100

Reference article:

PowerShell prerequisites for running the invoke-sqlcmd command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.