Powershell - my mild rant

wixter

Weaksauce
Joined
Mar 8, 2012
Messages
88
So this rant is about powershell. Having worked in the IT industry for 20+ years, the majority of those doing system administration type stuff, I've seen a lot of things come and go over the years. Powershell is now on my most recent "this is getting annoying" list.

Hear me out first....

Powershell is a great tool because Microsoft has standardized methods of customizing a lot of different attributes either in the o/s itself or within Active Directory or other apps that touch it, like Exchange, whereas previously you'd be stumbling through WMI queries or whatever else flavor of the day was used to build it and it stuck around for a while. I'm glad to see that powershell can be used for so many different things and you don't have to screw around with other irrelevant junk.

Now on to my rant.

Powershell is a tool like any other. I've found that powershell is great for handling repetitive tasks or instances where you need to make the same change to a lot of objects. It's a tool. Like any tool it has its uses. It is not be all, end all of everything regarding computing or admin work. It's really starting to piss me off because I come across people now who have drunk so much of the powershell koolaid that they want to devise a powershell solution for every freaking task imaginable. I'm not making this crap up when I say we now have support techs in our department who want to sit and code powershell for a problem that impacts all of about 20 workstations. It will take them over 2 hours to come up with a proper script and even then they haven't tested it. Meanwhile I physically walked up to each of those workstation, made the changes manually, and was finished in about 35 minutes.

The other thing that's pissing me off is how, as an example, Microsoft is going full speed ahead with this crap for everything that even very basic tasks (such as in Exchange) you have to execute some long ass powershell command just to see a certain status on a server, or retrieve the state of a user's mailbox. Why can I not actually see this in the admin console? Who the hell knows!

Folks I've got news for you. Some of the most big iron server operating systems back in the day were Unix, and unix uses command line for everything. People back then wanted graphical interfaces because they were easier to navigate, control and you had the ability to get a better view of many tasks all at once. Yet now we're trying to sell everyone on the fact that going back to command line is better? I should be able to click a freaking button to enter maintenance mode on a server (maybe include a confirmation), not have to execute some longass script to kick it off, and oh of course I also have to remember specifically which script to kick off and in what order. If I didn't have the scripts saved then I'd have to execute each and every damn command by hand, in order, and I'd have to remember all this crap. Tabbing through commands is not helping jack. And I know I'm not the only who feels this way! When I mentioned earlier about the Exchange console not being able to display certain properties or status, you have to use powershell to find it out. You know it's pretty bad when a third party company now SELLS software that executes all of those powershell commands needed to display the status and then puts it into a graphical display in your browser - exactly what I wanted in the first place!

I suppose what I'm really getting sick of is the people who just buy into this crap so readily and can't seem to properly troubleshoot a problem or think of a solution if their life depended on it. They know of only one way to tackle the issue and one tool to use.
 
In Windows 10 you have to use Powershell (well, or CMD) in order to bring up the old Personalize menu to easily arrange different wallpapers on separate monitors. Also, it's a great way to massively uninstall modern apps. But I can understand what you mean to a certain extent. Let the guys tinker away with it, they'll get better over time and maybe a powershell script will save you all one day.

Powershell -- fixing problems with Microsoft's OS one command at a time! When your company relies on powershell, thats job security!


What I find slightly odd about it is its long-hand way of using syntax. All command line tools were usually short-hand syntax ie "-w" wide listing, "-R" for recursive, now with powershell everything is long hand. Makes it easier to read, and probably better in the long run, but still looks odd when you're so used to short-hand syntax.
 
Last edited:
I like powershell for automating tasks, but the syntax is totally unlike anything else I've ever used. It doesn't resemble batch files, shell scripts, perl, C# or VB. As a result I need to look everything up every time I want to do anything. This is a huge time sink (and I'm a .NET developer). I don't know what they where thinking when they designed this scripting language. I would actually rather it all be in Javascript!
 
we now have support techs in our department who want to sit and code powershell for a problem that impacts all of about 20 workstations. It will take them over 2 hours to come up with a proper script and even then they haven't tested it. Meanwhile I physically walked up to each of those workstation, made the changes manually, and was finished in about 35 minutes.

Sounds like the problem is the tech, not powershell. This kind of trap can catch any language. I've unintentionally spent much longer on VBScripts than it would have taken me to manually fix something. With that said, once I have a script I can run it and be done if the problem ever creeps up again. When you're writing a script to solve a problem, you have to figure out if it's worth the time spent writing it. If bad decisions are made, it's not powershell's fault!


The GUI on Windows Server is going away. We had a taste of it in Server 2008 with Server Core, and they took it one step further. Most Windows security patches revolve around the GUI. If you remove the GUI, you remove a HUGE attack vector and your server is quite a bit more secure. Admins who want a secure server need to be able to manage their server from a command line, and that is exactly what powershell gives you.

It doesn't resemble batch files, shell scripts, perl, C# or VB. As a result I need to look everything up every time I want to do anything. This is a huge time sink (and I'm a .NET developer).
Thats an interesting statement considering half of my learning curve was that I was unfamiliar with .net objects and how they are used. I now often refer to .net documentation to get at objects when I need help...
 
This rant shouldn't be about Powershell, but should be about techs in general and it has always been an issue even back in the old Unix days of everything being command line. People will always want to do things their way using whatever new tool they thing is the bee's knees.

But Powershell itself is a great tool and took MS long enough to finally create something that equaled the kind of environment you got in Unix. They were starting to lose a lot of business to Unix server farms because they were cheaper and easier to maintain. Although honestly I would say MS has more powerful tools for servers, many companies don't need all those options. Powershell and their light installations really helped stem some of that tide.

As for the GUI, I have always found ways of getting GUIs in windows. You usually just have to find the right areas to manipulate and then you can get a GUI of almost anything.
 
Thats an interesting statement considering half of my learning curve was that I was unfamiliar with .net objects and how they are used. I now often refer to .net documentation to get at objects when I need help...

You misunderstand my statement, I'm talking entirely about syntax. And yes, you can reference .NET objects, but it's not the preferred method, they want you to use their commandlets.
 
Most cmdlets have a shorthand - I still write most of my scripts with the longhand, in case the next person (or whoever ends up running it, as a lot of scripts I'm starting to publicly share) can easily dissect it if needed.

I also agree with the posters who point out your rant isn't about powershell, but about the techs who made bad choices. PowerShell is as useful, as as much a timesink, as you let it. I switch back and forth between command lines and GUIs all day. Use the correct tool for the correct function, with both short term need and long term pain points addressed and considered.
Those 20 computers you fixed in 35 minutes? Great, you did it faster than they made their script. What if, down the line, you need to do it to 200 computers? Or perhaps you run into a very similar issue at your next place of employment? THen, you have your script already completed - probably a few small tweaks and off you go.
 
I'm a sysadmin, not a programmer.
shit does get old, since now I have to learn all this scripting shit to do the same tasks I've been doing for ages.
 
So this rant is about powershell. Having worked in the IT industry for 20+ years, the majority of those doing system administration type stuff, I've seen a lot of things come and go over the years. Powershell is now on my most recent "this is getting annoying" list.

Hear me out first....

Powershell is a great tool because Microsoft has standardized methods of customizing a lot of different attributes either in the o/s itself or within Active Directory or other apps that touch it, like Exchange, whereas previously you'd be stumbling through WMI queries or whatever else flavor of the day was used to build it and it stuck around for a while. I'm glad to see that powershell can be used for so many different things and you don't have to screw around with other irrelevant junk.

Now on to my rant.

Powershell is a tool like any other. I've found that powershell is great for handling repetitive tasks or instances where you need to make the same change to a lot of objects. It's a tool. Like any tool it has its uses. It is not be all, end all of everything regarding computing or admin work. It's really starting to piss me off because I come across people now who have drunk so much of the powershell koolaid that they want to devise a powershell solution for every freaking task imaginable. I'm not making this crap up when I say we now have support techs in our department who want to sit and code powershell for a problem that impacts all of about 20 workstations. It will take them over 2 hours to come up with a proper script and even then they haven't tested it. Meanwhile I physically walked up to each of those workstation, made the changes manually, and was finished in about 35 minutes.

The other thing that's pissing me off is how, as an example, Microsoft is going full speed ahead with this crap for everything that even very basic tasks (such as in Exchange) you have to execute some long ass powershell command just to see a certain status on a server, or retrieve the state of a user's mailbox. Why can I not actually see this in the admin console? Who the hell knows!

Folks I've got news for you. Some of the most big iron server operating systems back in the day were Unix, and unix uses command line for everything. People back then wanted graphical interfaces because they were easier to navigate, control and you had the ability to get a better view of many tasks all at once. Yet now we're trying to sell everyone on the fact that going back to command line is better? I should be able to click a freaking button to enter maintenance mode on a server (maybe include a confirmation), not have to execute some longass script to kick it off, and oh of course I also have to remember specifically which script to kick off and in what order. If I didn't have the scripts saved then I'd have to execute each and every damn command by hand, in order, and I'd have to remember all this crap. Tabbing through commands is not helping jack. And I know I'm not the only who feels this way! When I mentioned earlier about the Exchange console not being able to display certain properties or status, you have to use powershell to find it out. You know it's pretty bad when a third party company now SELLS software that executes all of those powershell commands needed to display the status and then puts it into a graphical display in your browser - exactly what I wanted in the first place!

I suppose what I'm really getting sick of is the people who just buy into this crap so readily and can't seem to properly troubleshoot a problem or think of a solution if their life depended on it. They know of only one way to tackle the issue and one tool to use.

Just change the name to VB, pearl, python, kix, or whatever scripting language and the issue is the same.

But PS is an awesome way to automate tasks, like SQL backup for instance. I made a script that backups, 7zips and store databases into a Synology NAS.
 
Just change the name to VB, pearl, python, kix, or whatever scripting language and the issue is the same.

But PS is an awesome way to automate tasks, like SQL backup for instance. I made a script that backups, 7zips and store databases into a Synology NAS.

I keep hearing just how great PS is, so I'd like to learn it. What is the best way to get started? Which resources?

I'm not a developer and not a sysadmin, unless you consider management of a small home LAN to be like a sysadmin job. I go back to DOS 1 (and CP/M), so I've done my share of *.bat files.

Thanks.
 
I keep hearing just how great PS is, so I'd like to learn it. What is the best way to get started? Which resources?

I'm not a developer and not a sysadmin, unless you consider management of a small home LAN to be like a sysadmin job. I go back to DOS 1 (and CP/M), so I've done my share of *.bat files.

Thanks.

Honestly, I'd start with "hey scripting guy". Alternatively, since you've done .bat, you can start with the ss64 reference. Everything else, I'd do a lot of tab completion (works on names, arguments, and arguments to arguments, assuming the cmdlet is written correctly) and msdn searches :).
 
x509, you can use the microsoft virtual academy to learn things like power shell too.
I have heard that the learn power shell in a month of lunches is a good starting point as well.
 
x509, you can use the microsoft virtual academy to learn things like power shell too.
I have heard that the learn power shell in a month of lunches is a good starting point as well.

Those are both of the resources I used for starting out and they worked pretty well for me.

https://www.microsoftvirtualacademy...g-started-with-powershell-3-0-jump-start-8276
https://www.microsoftvirtualacademy...scripting-with-powershell-3-0-jump-start-8277
http://www.amazon.com/Learn-Windows...TF8&qid=1440162590&sr=8-1&keywords=powershell
 
As an Amazon Associate, HardForum may earn from qualifying purchases.
I like powershell, my only complaint about it is that on a workstation it is limited to what you can do. more options in a server than in a workstation in other words.

as for exchange you have the ECP, or management console, just install it and you will be able to see how much mailbox space someone has used. we are using exchange 2013 here and I have no problems with it. I have no idea why you are complaining other than, like most those in IT you don't want to learn anything new.
 
Workstations are only limited by what modules you have in place, obviously there isn't a lot of administrative type software installed on workstations usually so there won't be as much of a need for it but you can still tie in to the modules on servers with invoke-command / PSRemoting.

I sort of understand where the OP is coming from if you have people whose sole purpose is to create PS scripts for every single little task that they do. I briefly fell into that trap, but for where I work we maintain a lot of systems with nearly identical configurations, so it will be nice to have scripts setup to verify that they have the same configurations across the board or update the same setting on all of the systems from a centralized location. With PS scripts it mostly comes down to making the distinction between a task that will be performed 1 time on a few machines and never again, and a task that in some manner will be repeated across many systems/many time over the years.
 
Workstations are only limited by what modules you have in place, obviously there isn't a lot of administrative type software installed on workstations usually so there won't be as much of a need for it but you can still tie in to the modules on servers with invoke-command / PSRemoting.

I sort of understand where the OP is coming from if you have people whose sole purpose is to create PS scripts for every single little task that they do. I briefly fell into that trap, but for where I work we maintain a lot of systems with nearly identical configurations, so it will be nice to have scripts setup to verify that they have the same configurations across the board or update the same setting on all of the systems from a centralized location. With PS scripts it mostly comes down to making the distinction between a task that will be performed 1 time on a few machines and never again, and a task that in some manner will be repeated across many systems/many time over the years.

i work with 32 women, for some crazy freaken reason being in one spot is not good for them, they want to move every 3 months and management allows that to happen, (yes they are women also) every time they move a new profile is created on a workstation, certificates for websites have to be uploaded so they can access the website. just as they all get moved a couple of them will quit, that starts the WHOLE freaken process again. having a script to install everything is very helpful. though at times there is options missing on a workstation that provides powershell from doing a complete job. thats just my problem and I guess I can look at it this way, it is job security.
 
I'm a sysadmin, not a programmer.
shit does get old, since now I have to learn all this scripting shit to do the same tasks I've been doing for ages.

You weren't automating this stuff prior to Powershell coming out in 2007?

:confused:
 
I don't get OP's complaints about PS either. It's a handy tool for administration, and is quite flexible. If you can do things manually without it, and also remember to do the same repetitive tasks on all reloaded/new machines... here's a cookie and a pat on the head because that's the only thing I'd give you instead of a job. :p
 
I don't get OP's complaints about PS either. It's a handy tool for administration, and is quite flexible. If you can do things manually without it, and also remember to do the same repetitive tasks on all reloaded/new machines... here's a cookie and a pat on the head because that's the only thing I'd give you instead of a job. :p

Seriously, who does everything one by one unless absolutely necessary?

:confused:
 
Seriously, who does everything one by one unless absolutely necessary?

:confused:

is_it_worth_the_time.png
 
I like powershell for automating tasks, but the syntax is totally unlike anything else I've ever used. It doesn't resemble batch files, shell scripts, perl, C# or VB. As a result I need to look everything up every time I want to do anything. This is a huge time sink (and I'm a .NET developer). I don't know what they where thinking when they designed this scripting language. I would actually rather it all be in Javascript!

/thread

The few times I looked at some examples, my toenails rolled up, my brain crumpled and I couldn't see through my facepalm anymore.

The usual convoluted Microsoft crap, UNIX reinvented poorly.
 
The usual convoluted Microsoft crap, UNIX reinvented poorly.
Considering that PS is not intended to copy Unix automation, and it's designed to approach the task in a different way, that's the start of your problem understanding it.

PS is pretty consistent and not difficult to learn. If you expect it to be something else, that's not really going to get you anywhere. There are multiple ways to script under Windows and if you want to do it another way nothing is stopping you other than realizing it's more work than necessary. :p
 
Considering that PS is not intended to copy Unix automation, and it's designed to approach the task in a different way, that's the start of your problem understanding it.

PS is pretty consistent and not difficult to learn. If you expect it to be something else, that's not really going to get you anywhere. There are multiple ways to script under Windows and if you want to do it another way nothing is stopping you other than realizing it's more work than necessary. :p

I used to feel as TCM2 did. I'd cut my teeth on scripts using one letter command lines that generally were short to type by hand because argument completion wasn't really supported. Yet they were short and there were plenty of copy/paste/tweak examples for most things.

Then I did some real powershell development. It changed my opinion from "well, I guess we're trying to make our own thing" to "omg it's amazing what you can do when you have common functionality, naming conventions, tab completion of arguments and argument values, pipelines that support complex objects and don't require massive time investment trying to re-parse stuff to fit the next piece's input expectations, etc." Now I go back to my linux VMs and get annoyed when that isn't available :-\.

To me, powershell feels like what linux/unix command line tools would have done had they been invented 10-15 years later than they were. The first plunge was a bit shocking and vastly alien, but after that I have a hard time enjoying what I go back to when I'm not on Windows.
 
I think the problem with powershell is that people thinks is just a souped up DOS prompt.

It's completely different, in some cases somewhat overcomplex, but given the functionality is well worth it.

When I first started using it, I had DOS in mind and quickly got frustrated with the syntax.

Things looked way too complicated, even simple things like renaming a file or deleting a folder. But once you get past it, its a joy.

I'm much better with powershell now than I ever was with DOS.
 
Powershell is great when you are doing repetitive tasks and you want to automate things. But for quick stuff its a lot of effort with little payoff.
 
Powershell is great when you are doing repetitive tasks and you want to automate things. But for quick stuff its a lot of effort with little payoff.

Powershell is pretty much the opposite of Bash and such shells. With Bash you can quickly string together a pile of small tools to perform rather complex tasks quickly. With PowerShell you spend the first hour just digging through the documentation, the second hour cursing at all the bloody UpperAndCamelCaseNonSense.

So far I have seen very little actual benefit of PowerShell and I much rather just use the MSYS shell on Windows with the same familiar Bash-style environment I'm used to.

To each their own, though.
 
^ PS is case insensitive, except for files and folders names if you forced case sensitivity in Windows.
 
I'm actually casually going through the introduction video and I see why they do certain things because of everything-is-an-object.

What I really found appaling in that video is how that one guy - self-proclaimed former UNIX guy and PowerShell inventor - was trying to explain how you'd do stuff in UNIX and completely fucking up the explanation, like you'd have to do column-wise text analysis and manually parse numbers and such crap. That was either really stupid or really dishonest.
 
^ PS is case insensitive, except for files and folders names if you forced case sensitivity in Windows.

I may have confused that with that poor excuse for a package manager they crammed into the new Visual Studio versions. Pretty sure that one is case-sensitive.
 
Back
Top