March 30, 2016 at 8:48 am
David.Poole (3/30/2016)
...Have I got the wrong end of the stick in thinking of it as Bash for Windows but with access to the .Net framework?
I don't think so. A simplification for sure but not overly so.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
March 30, 2016 at 8:50 am
I've tinkered with it, but don't particularly like it as a language to work with. It certainly has its usefulness, but before I ended up a SQL Server DBA I worked at places that had a mix of Oracle and SQL Server, and of Unix and Windows. I always loved the Unix shells - in comparison Powershell is just so clunky and verbose. That comparison probably also applies to T-SQL and Powershell - T_SQL is a lot more succinct in its syntax.
I know I'll have to get my head round Powershell's way of working at some point, but It will be hard to overcome that basic level of dislike for what it feels like to work with.
March 30, 2016 at 9:31 am
I use PowerShell a lot and it has been a huge time saver. I manage a lot of servers and checking remote servers used to involve opening an RDP session. I've customized my $profile and created a few custom functions to do a lot of this from a local command line(Powershell command). As a DBA it's helped me with creating automated database copy routines, even with a 3rd-party backup utility.
I do have a bit of .NET development experience so that's been helpful but IMHO, PowerShell is worth the time investment to learn.
March 30, 2016 at 9:40 am
RP1966 (3/30/2016)
...I always loved the Unix shells - in comparison Powershell is just so clunky and verbose...
I think that you might benefit a lot from the aliases which mostly are the same as *nix and DOS commands.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
March 30, 2016 at 10:55 am
Gary Varga (3/30/2016)
RP1966 (3/30/2016)
...I always loved the Unix shells - in comparison Powershell is just so clunky and verbose...I think that you might benefit a lot from the aliases which mostly are the same as *nix and DOS commands.
Precisely why I don't use PowerShell. 😉 Throw in WMIC and I just don't need it nor do I have to bother with writing loops. :w00t:
--Jeff Moden
Change is inevitable... Change for the better is not.
March 30, 2016 at 11:20 am
I really didn't see much value initially, but over time I've used it more and more. It started when I found the DBATools module on github (https://github.com/ctrlbold/dbatools). We have a lot of servers and migrating logins and databases between them was a very frequent task. It was pretty easy to script out with t-sql, but much quicker to setup with the PowerShell functions.
I've also used it to automate our SQL Server configuration, which has saved significant time since we spin up new servers relatively frequently. So there is a learning curve, but I've found it to be a valuable toolset under the right circumstances.
March 30, 2016 at 11:52 am
Powershell is awesome! Then i'm a former developer, so it was like the power of .net without the annoying user interface layer to program. It just does what i tell it to.
March 30, 2016 at 12:24 pm
Manic Star (3/30/2016)
Powershell is awesome! Then i'm a former developer, so it was like the power of .net without the annoying user interface layer to program. It just does what i tell it to.
I'm amazed at what some people us it for without thinking of the consequences. One of the "big" and well advertised uses for it is to control all backups for all servers from a single central location. If it's used to push backup jobs onto a scad of servers so that they can operate autonomously, that's a regular "Martha Stewart Moment". But if it's used to do/control the actual backups on all the servers, then you have to ask yourself what's going to happen to the log files on all the databases on all the servers if that central location fails for even a couple of hours.
I'm also amazed when people call PS from SQL Server to call <insert drum roll here> SQLCMD (heh... SERIOUSLY?). It usually doesn't make any sense to me. :pinch:
--Jeff Moden
Change is inevitable... Change for the better is not.
March 30, 2016 at 12:45 pm
Jeff Moden (3/30/2016)
Manic Star (3/30/2016)
Powershell is awesome! Then i'm a former developer, so it was like the power of .net without the annoying user interface layer to program. It just does what i tell it to.I'm amazed at what some people us it for without thinking of the consequences. One of the "big" and well advertised uses for it is to control all backups for all servers from a single central location. If it's used to push backup jobs onto a scad of servers so that they can operate autonomously, that's a regular "Martha Stewart Moment". But if it's used to do/control the actual backups on all the servers, then you have to ask yourself what's going to happen to the log files on all the databases on all the servers if that central location fails for even a couple of hours.
I'm also amazed when people call PS from SQL Server to call <insert drum roll here> SQLCMD (heh... SERIOUSLY?). It usually doesn't make any sense to me. :pinch:
First thing i used it seriously for was consuming a json file into SQL, and creating another json file out of sql. I've also used it to fix flat files that came from a 3rd party source that was clueless how to put it in a format i needed etc. Its become my go-to tool for spackles when something native in the sql toolbox just wont do what i need.
March 30, 2016 at 12:54 pm
I took one of those quickie 2 or 3 day classes in Powershell and thought it was a very interesting idea using the .net framework to expand the power of a scripting language. But as is usually true of those quickie classes, I did not have any use for Powershell at the time and quickly forgot most of what I learned. I'm not a DBA nor a system administrator and those seem to be the types of roles where PS is most useful (being able to apply changes or retrieve information from multiple servers, etc., using one tight script which can not only address the entities necessary but even interact with their object models, is a pretty exciting prospect). For me, there have been very few occasions where it seemed like a good solution to a problem I was trying to solve. And while the aspect of interacting at an object level is extremely useful for some things, its arsenal seems to lack some of the really powerful tools that make Unix scripting so attractive: tools such as AWK, or SED (though it's possible that I'm merely speaking from ignorance on that point).
the few times I've felt like it would help me, I've searched the internet and found some boilerplate code which pretty much did what I wanted, but there has been no compelling reason for me to try to gain expertise with it, so far. I am glad that it is there, however.
- Les
March 30, 2016 at 2:50 pm
With Microsoft releasing SQL on Linux in 2017....and now the announcement that BASH is coming to Windows, is Powershell still relevant? Why wouldn't DBA's just learn and use Python?
March 30, 2016 at 3:13 pm
Jeff Moden (3/30/2016)
Manic Star (3/30/2016)
Powershell is awesome! Then i'm a former developer, so it was like the power of .net without the annoying user interface layer to program. It just does what i tell it to.I'm amazed at what some people us it for without thinking of the consequences. One of the "big" and well advertised uses for it is to control all backups for all servers from a single central location. If it's used to push backup jobs onto a scad of servers so that they can operate autonomously, that's a regular "Martha Stewart Moment". But if it's used to do/control the actual backups on all the servers, then you have to ask yourself what's going to happen to the log files on all the databases on all the servers if that central location fails for even a couple of hours.
I'm also amazed when people call PS from SQL Server to call <insert drum roll here> SQLCMD (heh... SERIOUSLY?). It usually doesn't make any sense to me. :pinch:
In the past, I never had any interest in PowerShell, because any task I would have typically used it for, I could just as easily do in T-SQL or a command line or maybe a .BAT file. However, in my most recent role as an Enterprise DBA, I can see the value in scripting a process consisting of tasks that span multiple instances, kick off ftp file transfers, call web services, edit registry keys, stop / start srevices, etc. Specifically, I maintain a rather substantial end-to-end silent install script for SQL Server that can be run manually or deployed hand-off from Octopus. Even if some aspects of this process could be more gracefully executed separately, having it all in one PowerShell script ties it all together, and just as important, it's self documenting. It's something that be read in total, shared, and versioned in VCS as it changes over time. It doesn't matter if I've taken the day off from work, if someone needs to spin up an instance of SQL Server in a new VM, there is a script for that.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
March 30, 2016 at 9:54 pm
Powershell is cool. I only worked with it once for about 10 weeks scripting out a SQL Server Install in the Google cloud using the Google SDK. As some people said, it borrows stuff from a few different programming languages that I have worked with.
The thing that KILLS me about PowerShell is how you declare a variable
$x = "ABC"
You turn off your computer, go on vacation, come back a week later, turn on your computer and you still have a variable, $x, with the value of "ABC". This makes me crazy. :crazy:
-- Itzik Ben-Gan 2001
March 31, 2016 at 12:22 am
Jeff Moden (3/30/2016)
...I'm also amazed when people call PS from SQL Server to call <insert drum roll here> SQLCMD (heh... SERIOUSLY?). It usually doesn't make any sense to me. :pinch:
There is no helping some people.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
March 31, 2016 at 12:25 am
lnoland (3/30/2016)
...its arsenal seems to lack some of the really powerful tools that make Unix scripting so attractive: tools such as AWK, or SED (though it's possible that I'm merely speaking from ignorance on that point)...
There doesn't appear to be enough "...if you've come from Unix" articles. This would help a lot of people.
(Not me but then again I think that I am beyond help anyway :crazy:)
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
Viewing 15 posts - 16 through 30 (of 44 total)
You must be logged in to reply to this topic. Login to reply