PowerShell Basics

  • Comments posted to this topic are about the item PowerShell Basics

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • Thanks Shawn. I have yet to use Powershell but this article has been a timely prompt.

  • Thanks for the article Shawn. This is really helpful, I appreciate all the links you've provided as well.

    Adam Sottosanti

  • parcival (1/24/2011)


    Thanks Shawn. I have yet to use Powershell but this article has been a timely prompt.

    Thanks, I wish my current job required me to use it more than I do. :hehe:

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • Adam Sottosanti (1/24/2011)


    Thanks for the article Shawn. This is really helpful, I appreciate all the links you've provided as well.

    You are welcome...here is one I left out cause I did not know if the link would stay active or not:

    Bing Visual Search - PowerShell

    If the link does not work, just go to http://www.bing.com search for just "PowerShell". You should see a tab show up under the search box called "Visual Search". It is a cool little graphical tool Bing created to browse the major commands and show some syntax.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • Shawn:

    Thanks for the great article.

  • Nice introduction to PowerShell! For a bit more geared toward those interested in SQL Server and PowerShell, I wrote a two-part introduction entitled Practical PowerShell for SQL Server Developers and DBAs that shows, among other cool features, how to navigate in "SQL space" just like you can navigate in a file system. See https://www.simple-talk.com/sql/database-administration/practical-powershell-for-sql-server-developers-and-dbas-%E2%80%93-part-1/

  • Nice article, I'm a recent fan of PowerShell. I didn't know about the ISE. I found a use for it beyond metrics and administration that other DBA's might find useful: data traffic. I route a large chunk of our EDI traffic (text files mostly) into filetables with it. The script opens the file, reads what it needs, makes the necessary db calls, logs it, and moves it to point B. In the past I would have considered a CLR routine, but now I find myself asking myself if I can do it in PowerShell first.

  • following the logic that "the only dumb question is the one which doesn't get asked"-- how do you start Powershell? from SSMS, cmd prompt?

    Hey, you said "basic". That's where I'm at.

    Thanx!

    Wallace Houston
    Sunnyland Farms, Inc.

    "We must endeavor to persevere."

  • Caruncles (6/5/2014)


    following the logic that "the only dumb question is the one which doesn't get asked"-- how do you start Powershell? from SSMS, cmd prompt?

    It can differ a bit based on Operating System where within the start menu you find "PowerShell" to open it. As well, in some instances you want to start PowerShell "as Administrator" to have an elevate privileges within the PowerShell prompt.

    Basic:

    To just open PowerShell prompt (powershell.exe):

    - Start Menu, just type "PowerShell" for Windows 7 and onwards (including Server 2008 and up), this brings up the list for the ISE and just prompt both (x86) and x64 if you are on 64-bit server.

    To open SQL Server PowerShell (sqlps.exe):

    - Start Menu, just type "sqlps.exe". You generally will not see to many folks use this method.

    - Within SSMS 2008 or higher, right-click a folder or container and click "Start PowerShell".

    Note that using sqlps.exe you are not in the full blown "Powershell" world, you enter into SQL Server's made up world so to speak. The basic to understand is that general PowerShell commands may not work as you thing they should. This is because of the provider you are in within that particular prompt.

    Open SQL Server PowerShell from PowerShell.exe:

    - This is the most common method found and a bit easier to work in.

    - Within PowerShell prompt for SQL Server 2008 - SQL Server 2008 R2 you type: Add-PSSnapin *SQL*

    - Within PowerShell prompt for SQL Server 2012 and up you type: Import-Module SQLPS

    If you are at the basics I would start by reading through this guide, even though it is version 1.0 it covers the basics of how PowerShell operators.

    Then I would highly suggest watching the beginner PowerShell videos from MidnightDBAs, how I got started in it all.

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • After I posted I found the program was installed on my PC. I went to start/programs and there it was. If I knew it was there I'd forgotten. I don't know if it came in with the SDK for Visual Studio or what, but I don't remember installing it. However, your reply is very helpful in several ways, because I will probably be using it in and outside of SQL. So THANX!

    Wallace Houston
    Sunnyland Farms, Inc.

    "We must endeavor to persevere."

  • using a search I found a "Documents" folder under USERS, but there is no Documents folder under any Windows profile in the USERS folder. Windows 7 won't let me change the folder options on that folder. Thanx Microsoft. I don't understand how Powershell can show me where the profile is but I can't see the folders. How can I open it with notepad? This has turned into a Windows 7/hatin' Microsoft issue for me.

    Wallace Houston
    Sunnyland Farms, Inc.

    "We must endeavor to persevere."

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

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