Stairway to SQL PowerShell Level 1: SQL PowerShell Basics

  • Comments posted to this topic are about the item Stairway to SQL PowerShell Level 1: SQL PowerShell Basics



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

  • I think I will follow this series. It makes it look all very simple. And I'm curious to see what you can do with it in regards to SQL Server.

    Just one minor omission: you make reference to Fig 1.3 but the figure is not pesent.

  • Thanks. I have submitted to have the graphic re-added to the level.



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

  • Thank you, the timing for this couldn't have been better as I'm looking into Powershell now, it's an area I've been avoiding too busy to concentrate on 🙂 Thanks for the stairway, I'll be following the series.

    I'm also finding Sean McCown 's videos to be very useful, he's got a fair few demos online on using Powershell, from basic stuff to more detailed SQL Server uses. http://midnightdba.itbookworm.com/AllVids.aspx, search for 'Powershell'.

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

  • Thanks.

    I will be posting some videos related to my stairway at my youtube channel http://www.youtube.com/dbaduck and at http://dbaduck.com as well.

    I know Sean and have seen his videos.

    There will be more levels posted soon.



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

  • Thanks for the nice series. I wanted to learn this since a long time. I think that time has arrived now.

    I tried the examples in this first article. Everything worked fine except at the end, when I tried to edit profile. Notepad just informed me that path doesn't exist and didn't give me any option to create new file. What should I do?

    I am using Win7 and running PowerShell as administrator.

    Thanks.

  • You should be able to from a PowerShell window run the following and then do the notepad $profile thing.

    New-Item $profile -force -type File

    notepad $profile



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

  • After fixing a few typos, I was able to get the expected result.Thanks.

    One think I noticed is that, in the profile script, $Host.Name is appended twice. I guess it was an oversight.

    Thanks again.

  • I will see about getting the example changed to not be redundant.

    Glad things worked out.



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

  • I noticed this, too. I played around a bit trying to get the version (major & minor) included in the title as described and arrived at this:

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

  • William,

    I tried adding version as you mentioned and it worked. Thanks.

  • Good post 🙂

    I would've loved it if you could have covered the profiles also as part of the introduction as it becomes an integral part of the whole experience.

    -Hope is a heuristic search :smooooth: ~Hemanth
  • Thanks.

    Sorry for the brief coverage of profiles. There is a more in depth profile discussion later in the Stairway, so hopefully it will help more later.



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

  • I don't seem to be able to open file in notepad.

    PS C:\Users\rhassan> $profile

    C:\Users\rhassan\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

    PS C:\Users\rhassan> notepad $profile

    I keep on getting the error that path does not exist. I tried to browse to it and still same issue.

    Has anyone seen this

    Thanks!

  • dbaduck (8/8/2012)


    You should be able to from a PowerShell window run the following and then do the notepad $profile thing.

    New-Item $profile -force -type File

    notepad $profile

    Here is the statements to get this done for you.



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

Viewing 15 posts - 1 through 15 (of 37 total)

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