Powershell Script for regular DBA activities

  • Comments posted to this topic are about the item Powershell Script for regular DBA activities

  • Pretty nice bit of code, thanks.

  • Thanks !!

  • [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null

    This first line of code throws me an error says it can't find it....so is it specific to a certain version of SQL??

    TIA!!


    Thank you!!,

    Angelindiego

  • This assembly is required to call filesave and folderdialog box via powershell.

    Do you latest .net framework installed on your machine ?

  • I use to call this powershell script via batch file.

    Here is the code for the batch file

    @echo off

    powershell -executionpolicy bypass -File C:\Users\mayank\Documents\Powershell\SqlMisc.ps1

    pause

    Just change the path for the powershell script

  • er.mayankshukla - Wednesday, January 11, 2017 8:27 PM

    I use to call this powershell script via batch file.Here is the code for the batch file@echo offpowershell -executionpolicy bypass -File C:\Users\mayank\Documents\Powershell\SqlMisc.ps1pauseJust change the path for the powershell script

    THANK YOU!!!!!!!!


    Thank you!!,

    Angelindiego

  • Such utilities can be easily used by the developers in the team without making them approach to DBA for such tasks on various development or testing environments.

    Who fixes it when either the MDF drive or the backup drive get's filled up?  Who fixes it when one developer does a restore over a database of another that has a lot of critical test data in it?

    I give my Developers a whole lot of freedom on the Dev boxes but backups and restores won't ever be one of them.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • > Who fixes it when either the MDF drive or the backup drive get's filled up?

    They can do it them self.

    They are all sysadmins, if they can execute those commands.

    So, they do not need anybody else to maintain the server.

    _____________
    Code for TallyGenerator

  • Tried to run the  script in our environment it gives below error.
    Please help to fix it. 

    Exception calling "Open" with "0" argument(s):
    "A network-related or instance-specific error occurred while establishing a connection to SQL Server.
    The server was not found or was not accessible.
    Verify that the instance name is correct an d that SQL Server is configured to allow remote connections.
    (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

Viewing 10 posts - 1 through 10 (of 10 total)

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