SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Powershell Script for regular DBA activities


Powershell Script for regular DBA activities

Author
Message
er.mayankshukla
er.mayankshukla
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2130 Visits: 546
Comments posted to this topic are about the item Powershell Script for regular DBA activities
Iwas Bornready
Iwas Bornready
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34846 Visits: 886
Pretty nice bit of code, thanks.
er.mayankshukla
er.mayankshukla
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2130 Visits: 546
Thanks !!
Angelindiego
Angelindiego
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2762 Visits: 449
[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

er.mayankshukla
er.mayankshukla
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2130 Visits: 546
This assembly is required to call filesave and folderdialog box via powershell.
Do you latest .net framework installed on your machine ?
er.mayankshukla
er.mayankshukla
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2130 Visits: 546
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
Angelindiego
Angelindiego
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2762 Visits: 449
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.ps1pause

Just change the path for the powershell script

THANK YOU!!!!!!!!


Thank you!!,

Angelindiego

Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (425K reputation)SSC Guru (425K reputation)SSC Guru (425K reputation)SSC Guru (425K reputation)SSC Guru (425K reputation)SSC Guru (425K reputation)SSC Guru (425K reputation)SSC Guru (425K reputation)

Group: General Forum Members
Points: 425136 Visits: 43411
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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Sergiy
Sergiy
SSC-Forever
SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)

Group: General Forum Members
Points: 49465 Visits: 12745
> 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.
georgian2133
georgian2133
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 3
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)"
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search