connect to remote sql server without using SMO/ADO?

  • is it possible to connect to a remote sql server instance just using powershell, and avoiding SMO, ADO?

    Ive done a few searches on google but everything points to SMO to connect to a remote server.

  • think ive figured out i have to configure wsman on both my pc and the server to ensure they both can communicate. not fully sure what to do yet, but im on the right track.

  • WMF - Windows Management Framework - includes Powershell V2.0, Windows Remote (WinRM) and WPF. Enable WinRM on the servers you will be working with and you can start remote session from what machine you are currently on.

    Also, WMI commandlets and quite a few others accept -computername.


    "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
    Tony Hoare

    "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.

  • You can also try a roundabout way. If the purpose is to not use ADO/SMO yet use the power of powershell you could try something like using sqlcmd inside of a powershell session, since it can access all external commands like a cmd prompt.

    Joie Andrew
    "Since 1982"

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply