Stairway to SQL PowerShell Level 1: SQL PowerShell Basics

  • fmonsua (7/21/2015)


    $wintitle = $CurrentUser.Name + " " + $Host.Name + " " + $Host.Version

    Or

    $wintitle = "$($CurrentUser.Name) $($Host.Name) $($Host.Version)"



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • Thanks a lot for this! I've been looking for the most basic introduction to Powershell so that I can see how it will work for me with SQL Server. It's been tough to wade through what information is available in blogs and videos.

    This first article in the series gave me just what I needed to simply get my feet wet and explore just a little bit of PS. My only trip up came when I wasn't completely understanding where the profile file needed to be saved. I figured it out after re-reading the instructions a couple of times.

  • That's great. Glad you found it useful.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • dbaduck - Thursday, February 9, 2017 8:07 AM

    That's great. Glad you found it useful.

    I found it helpful too...Thank you!

  • Anyone else going through this stairway in 2020?  I am!!!

  • Hi Ben

    Listing 1.1

    $wintitle = $CurrentUser.Name + " " + $Host.Name + " " + $Host.Name

    Is this line of code correct ?

     

    Thanks

    Steve

     

  • No as illustrated above, instead of $Host.Name on the second one, it was supposed to be $Host.Version.

    Good catch.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

  • These are excellent articles about SMO written from 2012-2015.

    It would be great to have an update to PowerShell Core and SqlServer instead of SQLPS. Many links are to sites that no longer exist (such as codeplex) or are redirected to active sites.

  • Thanks Paul.  I am planning an update for all these Stairway Levels.  Not sure when though, but it is on my list.



    Ben Miller
    Microsoft Certified Master: SQL Server, SQL MVP
    @DBAduck - http://dbaduck.com

Viewing 9 posts - 31 through 38 (of 38 total)

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