Powershell to run on a specific DB instance

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 7 months ago.

  • Author
    Posts
  • #6385

    by chowdhury123 at 2013-03-12 15:54:17

    Hello All
    I have a powershell script that is working in the test environment which has only one SQL Server instance.
    Now when I go to another environment, which has multiple instance, how to I make sure it runs on a particular DB instance?
    I tried with
    powershell.exe FileName.PS1 -Instance:"InstanceName"
    with no luck.
    Searched the web, but could not find the solution.
    Can anyone please help?
    Thanks in advance.

    by Klaas at 2013-03-13 01:11:40

    Powershell does not run in a SQL instance, but it can connect to instances.
    What you need to do depends on the cmdlets you use.
    You can use Invoke-SQLcmd, navigate through the sql provider and other things. Usually you add the instancename to the host name, like SQLServername\Instancename, but again, it depends.
    Can you post the script?

You must be logged in to reply to this topic.