Day Zero with PowerShell

  • Comments posted to this topic are about the item Day Zero with PowerShell

    @SQLvariantI have a PowerShell script[/url] for you.

  • Should there be a space in the "Set-ExecutionPolicy RemoteSigned" command?

  • Thomas - yes. Also "ft -a" instead of "ft-a" in the example script.

    Other than that, finally got me going with PowerShell - thanks Aaron!

    Forum Etiquette: How to post data/code on a forum to get the best helpMake sure that you include code in the appropriate IFCode tags, e.g. <your code here>. You can find the IFCode tags under the INSERT options when you are writing a post.

  • Yes, there whould definitely be a space.

    Sorry, the editor isn't properly rendering the code that I posted.

    @SQLvariantI have a PowerShell script[/url] for you.

  • This is great...just great...

    One of the excuses obstacles for not getting started with PowerShell has been just getting things set up to be able to actually use the thing. This seemed to be a secret passed among an elite priesthood in dark misty passage ways. Not a place for mere mortals to tread.

    Now, along comes Aaron Nelson and puts everything in a single, easy to digest article.

    You've totally blown my excuse to not use PowerShell! Sheesh.

    Ok, seriously. Nice article, Aaron. It is very nice to have the requirements assembled in one place.

    Thank you!

  • Added spaces into the code. Should look fine now.

  • DJ (5/10/2011)


    Nice article, Aaron. It is very nice to have the requirements assembled in one place.

    Thank you!

    Thanks DJ, glad you liked it. There should be more 'good reasons' to use PowerShell coming out very soon 😉

    @SQLvariantI have a PowerShell script[/url] for you.

  • Thanks DJ. Can you maybe explain the purpose of the Set-ExecutionPolicy command? Also, when I tried the sample code, I got an error when trying to restart a server which I manually stopped:

    Start-Service : Service 'SQL Server Agent (SQL2008) (SQLAgent$SQL2008)' cannot be started due to the following error: Cannot open SQLAgent$SQL2

    008 service on computer '.'.

    At line:6 char:14

    + Start-Service <<<<

    + CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException

    + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand

  • Thanks much for all of these tips.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • For running the example script you will probably need to elevate your shell (I keep forgetting that I have a pre-emptive work-around in place for this). Just hold down the Ctrl + Shift Keys and then click on the shortcut for the ISE. Then run the script in that window.

    I'll work on getting a Summary for the Execution Policies however your best/most complete answer is in the Help files. June does a good job with those.

    @SQLvariantI have a PowerShell script[/url] for you.

  • Steve Jones - SSC Editor (5/10/2011)


    Added spaces into the code. Should look fine now.

    Mucho Mejor! Gracias Senior Jones.

    @SQLvariantI have a PowerShell script[/url] for you.

  • Good stuff! Wish I had found this article a year ago. I struggled getting started before. I hope this helps people just getting their feet wet.

  • Simply Great Work and i started learning Power Shell Atlast with your help. Looking forward for more classes.

    @JayMunnangi

  • Great article! I've been working at learning PowerShell for a little while now and look forward to future articles.

    I can manually stop the agent on my test server myself and when I run the script it will tell me that it is stopped but the script won't start it. I get this error:

    Start-Service : Cannot find any service with service name 'SQLSERVERAGENT'.

    At line:12 char:14

    + Start-Service <<<<

    + CategoryInfo : ObjectNotFound: (SQLSERVERAGENT:String) [Start-Service], ServiceCommandException

    + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.StartServiceCommand

    What am I missing?

  • Great article Aaron!

    Now that I have it installed and functional. (I've been procrastinating for a long time) I would really like to see more on what people are using PowerShell for on a daily basis. How can PowerShell make my life easier? I am not a DBA. I and another guy, manage about 100 MickySoft servers, six of them are SQL, for which we have a couple DBA's to do most of the data manipulation and application programming for. I have a SharePoint farm implemented, but the DBA's don't do much of anything there. I'm looking forward to more articles on PowerShell relative to SQL.

    Thanks.

    -Steve

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

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