Managing SQL Server with PowerShell

  • Comments posted to this topic are about the item Managing SQL Server with PowerShell

  • This was removed by the editor as SPAM

  • Interesting...

    This article https://msdn.microsoft.com/en-us/library/hh231286.aspx

    updated 8/1/16 does not indicate the deprecation and states

    Use the Import-Module cmdlet to import the sqlps module. Specify the DisableNameChecking parameter if you want to suppress the warning about Encode-Sqlname and Decode-Sqlname.

    Example

    This example loads the sqlps module with name checking turned off.

    Windows PowerShell

    # Import the SQL Server Module.

    Import-Module Sqlps -DisableNameChecking;

  • m mcdonald (11/28/2016)


    Interesting...

    This article https://msdn.microsoft.com/en-us/library/hh231286.aspx

    updated 8/1/16 does not indicate the deprecation and states

    Use the Import-Module cmdlet to import the sqlps module. Specify the DisableNameChecking parameter if you want to suppress the warning about Encode-Sqlname and Decode-Sqlname.

    Example

    This example loads the sqlps module with name checking turned off.

    Windows PowerShell

    # Import the SQL Server Module.

    Import-Module Sqlps -DisableNameChecking;

    That article was updated on 1st August, two months after the article referenced in the explanation. And importing SQLPS works fine on my system which is completely up to date with the latest updates of Windows 10 and SSMS 16. So I suspect that the "correct" answer is actually wrong (although it too can be made to work).

    Tom

  • SQLPS has been deprecated. The article update date is based on a change to the article, which could just be a typo correction or anything else. That does not indicate that there was a review of the content.

    The team that deals with the tools is referenced in the explanation and they are no longer doing work on SQLPS. While that module will import and work today, it will never get updated, just as SQL Trace still works today on SQL 2016, but it is missing many events and will never be updated.

    Deprecated != not working.

  • TomThomson (11/28/2016)


    m mcdonald (11/28/2016)


    Interesting...

    This article https://msdn.microsoft.com/en-us/library/hh231286.aspx

    updated 8/1/16 does not indicate the deprecation and states

    Use the Import-Module cmdlet to import the sqlps module. Specify the DisableNameChecking parameter if you want to suppress the warning about Encode-Sqlname and Decode-Sqlname.

    Example

    This example loads the sqlps module with name checking turned off.

    Windows PowerShell

    # Import the SQL Server Module.

    Import-Module Sqlps -DisableNameChecking;

    That article was updated on 1st August, two months after the article referenced in the explanation. And importing SQLPS works fine on my system which is completely up to date with the latest updates of Windows 10 and SSMS 16. So I suspect that the "correct" answer is actually wrong (although it too can be made to work).

    I saw the same thing. Good question, but I don't know enough about PowerShell to say whether the correct answer is correct.

  • Got it wrong - but at least I have plenty of company today.

  • That's pretty crappy documentation on Microsoft's part. I also found the answer on https://msdn.microsoft.com/en-us/library/hh231286.aspx, where it shows the example as

    #Import the SQL Server Module.

    Import-Module Sqlps -DisableNameChecking;

    The first reference Steve posted doesn't have any code related to SQL Server and the second is merely a blog post. If they want people to know what is correct it needs to be in the documentation, not just on a random blog post.

    Be still, and know that I am God - Psalm 46:10

  • david.gugg (11/28/2016)


    That's pretty crappy documentation on Microsoft's part. I also found the answer on https://msdn.microsoft.com/en-us/library/hh231286.aspx, where it shows the example as

    #Import the SQL Server Module.

    Import-Module Sqlps -DisableNameChecking;

    The first reference Steve posted doesn't have any code related to SQL Server and the second is merely a blog post. If they want people to know what is correct it needs to be in the documentation, not just on a random blog post.

    That's not a random blog post. That's the official announcement space for Microsoft SQL Server.

  • I am also in the camp that got it "wrong" today, but I can see how this is happening.

    The default Google search of "Import-Module SqlServer" lists the MSDN page (https://msdn.microsoft.com/en-GB/library/hh231286.aspx) first and the SQL Server Blog page (https://blogs.technet.microsoft.com/dataplatforminsider/2016/06/30/sql-powershell-july-2016-update/) second.

    As the official MSDN page gives a clear example of the "Import-Module Sqlps" syntax it's what most people will go for. This is evidenced by the number of people getting the question wrong.

    I think this shows that the official MSDN page should be improved and as a minimum refer to the content in the blog post to indicate that the preferred way of working with PowerShell has been changed.

  • m mcdonald (11/28/2016)


    Interesting...

    This article https://msdn.microsoft.com/en-us/library/hh231286.aspx

    updated 8/1/16 does not indicate the deprecation and states

    Use the Import-Module cmdlet to import the sqlps module. Specify the DisableNameChecking parameter if you want to suppress the warning about Encode-Sqlname and Decode-Sqlname.

    Example

    This example loads the sqlps module with name checking turned off.

    Windows PowerShell

    # Import the SQL Server Module.

    Import-Module Sqlps -DisableNameChecking;

    I got thrown off by the same article. I would have though they would have mentioned sqlps being deprecated if this article was newer? Nice question anyway.

  • Nice question, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 12 posts - 1 through 11 (of 11 total)

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