Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Power shell


Power shell

Author
Message
vijayarani87.s
vijayarani87.s
Valued Member
Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)

Group: General Forum Members
Points: 52 Visits: 137
Hi guys,

I am new to powershell, can anyone please help me in undertanding powershell. I googled about powershell. But i dint get any clear idea about it.

I would like to know about, for what purpose we are using powershell.
And i need to use powershell for deployment. Please help me on this.
BrainDonor
BrainDonor
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: 2050 Visits: 11200
A good starting point would be the Stairways series available on this site: http://www.sqlservercentral.com/stairway/91327/.

There is also the book "Learn Windows Powershell in a Month of Lunches".

Steve Hall
Linkedin
Blog Site
Laerte Poltronieri...
Laerte Poltronieri Junior-367636
SSC-Enthusiastic
SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)SSC-Enthusiastic (165 reputation)

Group: General Forum Members
Points: 165 Visits: 836
For me the best book ever on Posh V2 :

Windows PowerShell In Action 2d, Bruce Payette

$hell your Experience !!!
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8243 Visits: 14368
vijayarani87.s (10/1/2012)
I would like to know about, for what purpose we are using powershell.

Three properties of a given task that compel me to use PowerShell or another managed programming language like C# or SSIS over using T-SQL to accomplish the same task:

1. The need to interact with a file system, e.g. deleting old files, renaming existing files, executing a program, etc. If you're considering using xp_cmdshell or one of the undocumented extended procedures like xp_dirtree, don't, explore using PowerShell or another managed programming language like C# or SSIS.
2. The need to interact with multiple database instances, e.g. gathering information about an environment where I want to run the same query against 1-n instances and compare or do something with the results. If you're thinking of using Linked Servers, don't, explore using PowerShell or another managed programming language like C# or SSIS.
3. The need to interact with a service outside the SQL database engine, e.g. Active Directory, a Web Service, SharePoint, etc. If you're thinking of using CLR or the OLE Automation procs, don't, explore using PowerShell or another managed programming language like C# or SSIS.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45100 Visits: 39912
Heh... Or do like I do. Use xp_CmdShell to call PowerShell. ;-)

Of course, you should make sure you're system is properly locked down first.

--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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8243 Visits: 14368
Jeff Moden (10/1/2012)
Of course, you should make sure you're system is properly locked down first.

Properly locking down your system, what exactly do you mean by that?

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45100 Visits: 39912
opc.three (10/1/2012)
Jeff Moden (10/1/2012)
Of course, you should make sure you're system is properly locked down first.

Properly locking down your system, what exactly do you mean by that?


It's simple. Only the DBAs have SA privs and no non-DBA user or app has been given a proxy to execute xp_CmdShell directly. They can only do it through a stored procedure that can't even see the content of.

--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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8243 Visits: 14368
Jeff Moden (10/1/2012)
opc.three (10/1/2012)
Jeff Moden (10/1/2012)
Of course, you should make sure you're system is properly locked down first.

Properly locking down your system, what exactly do you mean by that?


It's simple. Only the DBAs have SA privs and no non-DBA user or app has been given a proxy to execute xp_CmdShell directly. They can only do it through a stored procedure that can't even see the content of.

Congratulations! You have boiled down 'Securing SQL Server' into less tHan 40 words! Hehe

The fact remains that enabling xp_cmdshell introduces risk into an environment and there simply is no reason one needs to enable it to manage a database.

For the original poster and any onlookers it is in your best interests to look beyond xp_cmdshell when evaluating how to solve an issue in SQL Server.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45100 Visits: 39912
opc.three (10/1/2012)[hrThe fact remains that enabling xp_cmdshell introduces risk into an environment and there simply is no reason one needs to enable it to manage a database.



That fact remains that you still have an unreasonable fear of it. Unless you've made the mistake of enabling a non-SA-prived individual to use it, only SA's can use if. If you have it turned off and you're apps have SA privs, the first thing an attacker will do is turn it on. It won't even slow the attacker down because he'll be expecting it.

BWAA-HAAA!!!! And there's nothing wrong with summarizing the security of SQL Server in 40 words or less. Many people apparently don't understand the basic idea of "only DBAs get SA". Perhaps the additional 11 words of "Don't forget to turn off the guest and builtin admin accounts" would help?

xp_CmdShell is useless in the hands of an attacker because, in a properly locked down system, he can't get his hands on it. You need to concentrate on properly locking down your system because that's the real problem.

--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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8243 Visits: 14368
Jeff Moden (10/2/2012)
opc.three (10/1/2012)[hrThe fact remains that enabling xp_cmdshell introduces risk into an environment and there simply is no reason one needs to enable it to manage a database.



That fact remains that you still have an unreasonable fear of it.

Sorry, but that dog won't hunt. All steps taken to prevent the use of xp_cmdshell are well-rooted in reason. It continues to astonish me that you are such an ardent proponent of it. Not only does it introduce risk into an environment but it might be one of the single-worst design choices for application development on the SQL Server platform.

Unless you've made the mistake of enabling a non-SA-prived individual to use it, only SA's can use if.

You're assuming that we as database professionals will be able to foresee and dictate all actions taken by someone with rights to change Active Directory. In a vacuum xp_cmdshell is harmless. In the real world it's a security risk. In a "properly locked down system" xp_cmdshell is disabled.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
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