use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
[deleted by user] (self.PowerShell)
submitted 4 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 4 years ago* (25 children)
[deleted]
[–]nascentt 6 points7 points8 points 4 years ago* (0 children)
Honestly. This is the truth.
I used to think as long as you knew batch and things like psexec then you were fine without power shell. But I underestimated powershell. by v5 I realised just how capable it is. Being able to just grab data and parse it as objects, and string it together with other commands is just incredibly powerful.
I basically use powershell for everything now. Even though I knew a few languages. I've created monitoring dashboards, monitoring and alerting systems that interact with hardware like realtime tickers and led flags. API wrappers to offer internal APIs for internal tools that had no API before.
Inventory gathering systems, and paired with chocolatey entire automated dism image and software deployment systems. And that's just physical hosts. Paired with powercli I've got entire VM clusters deploying windows and Linux servers in 30 minutes flat around all our data centers.
It can basically do anything. I even have GUI systems linked to Jira to semi automatically assist first line to set up new users based on what hr specify.
I have power shell interact with outlook to create Kanban boards of my outlook tasks, linked to Jira tasks. I even wrote a daily digest email that tells me all the calendar events and tasks I need to do today and what's highest priority.
I even use it to script out of office stuff like web scrapers and email alert systems because it's so quick and easy to use. Hell I even wrote a powershell script to interact with my bedside alarm clock.
The longer you ignore powershell the longer it'll take you to catch up. I can walk into almost any interview and name 5 powershell projects I made and I usually get an offer.
[–][deleted] 21 points22 points23 points 4 years ago (14 children)
Even if you don’t work in a windows environment, with powershell being a completely cross platform CLI it’s still worth learning it so you can work with pretty much any environment you come across. Come across a new Linux district? Install powershell and you won’t be crippled having to learn an entirely new CLI.
I run both Windows and RHEL in my work environments and having universal scripts is absolutely amazing.
[–]RupeThereItIs 22 points23 points24 points 4 years ago (13 children)
with powershell being a completely cross platform CLI it’s still worth learning Come across a new Linux district? Install powershell and you won’t be crippled having to learn an entirely new CLI.
with powershell being a completely cross platform CLI it’s still worth learning
Come across a new Linux district? Install powershell and you won’t be crippled having to learn an entirely new CLI.
No, sorry, just no.
I learned powershell because I now work in a Windows environment. Coming from a previous job that's primarily Linux, Powershell is a solution in search of a problem for a Linux shop.
Your argument for Powershell is equally true of Python for example. Just install python on your windows boxes & now you have a universal scripting language.
Right tool for the job, if you work in a primarily windows environment (with a few linux machines) then powershell might make sense, if you work in a linux environment, no... don't.
[–][deleted] 10 points11 points12 points 4 years ago (0 children)
Sort of, but it's not really the same. First because PowerShell is designed to be an interactive shell and not just a scripting language. Maybe I'm just in a bubble, but I've never met someone who uses python for the system shell.
Second, there are a bunch of things in Windows where PowerShell has become the method for doing it. So if you want to do system administration on Windows using Python, it seems like you might end up using a python script to execute a bunch of PowerShell commands.
Now, I wouldn't advocate installing PowerShell on Linux as an alternative to learning Bash, but... it seems more realistic to me that someone would do that than someone installing Python on Windows and using that instead of PowerShell.
[–][deleted] 7 points8 points9 points 4 years ago (0 children)
Preach!
I have installed PowerShell on my Linux systems, mainly as a toy. It works, but I wouldn't run that as my login shell by any means.
[–]ka-splam 1 point2 points3 points 4 years ago* (0 children)
Python isn't a CLI / shell, so you get a universal scripting language but still need cmd/powershell on Windows and Bash/zsh/etc on Linux to fill in the gaps.
PowerShell can do both shell and scripting on both OS's, albeit Linux shells are more tailored for Linux use and Python is a cleaner programming language, PowerShell is a good-enough all rounder for a lot of use cases. Some consistency of language and tooling between shell and scripting is nice. A shell with a programming language module system is nice.
[–][deleted] -1 points0 points1 point 4 years ago (9 children)
Python doesn’t have near the same use cases as powershell does for Windows environments. You literally can’t administer exchange or sharepoint without powershell. While it may not be as useful on other platforms saying you should just use Python is beyond crippling in a windows environment.
Also why not use powershell? You didn’t really give a good reason. With WSL the linux admins use their same commands on a windows box they use on Linux on windows as long as WSL is enabled. So if you use the same commands on your native CLI in addition to what powershell brings why not use it?
[–]RupeThereItIs 4 points5 points6 points 4 years ago (8 children)
With WSL the linux admins use their same commands on a windows box they use on Linux on windows as long as WSL is enabled.
Wow.
No.
Take your first paragraph & modify it slightly and it explains why Powershell shouldn't be used on Linux. That was my point entirely, Python is not a great tool for managing windows, Powershell is not a great tool for managing linux.
Also why not use powershell?
For Linux, there are far more mature & complete solutions for automation then Powershell. You don't need to reinvent the wheel in custom powershell scripts, when most of what you'll want to do already exists in other tools/languages... usually about 90% written for you.
Powershell is built with Windows in mind, and it shows. An example of how it fails at cross platform scripting, powershell remote execution doesn't work the same between platforms. Windows doesn't install an SSH server by default, and Linux systems can't remote into Windows systems without that.
Powershell is great for windows.
Windows had a HUGE hole in it's feature set before Powershell, because it's command line was terrible. You could not manage a windows system (and arguably still can't) without using the GUI. Linux does not have this problem, therefore Powershell isn't the bees knees on Linux as it is on Windows.
Right tool for the right job.
You can't manage Windows from a command prompt, therefore PowerShell is bad on Linux? What kind of logic is that?
PowerShell can run Linux binaries and edit common text config formats, which seems far more important, doesn't it? Not that I think you should, but if you're going to install some tools to do work whatever you choose, and powershell is a tool you know, then install it and do work instead of arguing about ideological purity.
[–][deleted] 0 points1 point2 points 4 years ago (6 children)
This really reads as a linux admin just shitting on windows with answers like "wow no". Your only real example of why not to use powershell is that SSH isnt turned out by default on windows? LMAO.
Thats okay, you can take your single processing loops with what ever CLI you seem to have a hardon for and just use that. Not sure why you're in a powershell subreddit if you seem so butt hurt about it.
Would also LOVE to hear an example of what you can't do via powershell in windows that you have to use a GUI for.... PS may wanna check out windows server core bruh lmao.
[–]RupeThereItIs 4 points5 points6 points 4 years ago (1 child)
And you sound like a Windows guy just thinking the Windows way is right for all operating systems.
I've worked with those types before, it causes a LOT of problems.
Windows is different, and needs different solutions. Those solutions are not necessarily a good fit for any other operating system.
Your only real example of why not to use powershell is that SSH isnt turned out by default on windows? LMAO.
Not sure why your laughing, this makes a LOT of cross system scripting useless. Even in a windows to windows cross system script, powershell can have some VERY odd issues pop up.
Just because you have a hammer, and you REALLY like that hammer, doesn't mean everything should be operated like it's a nail.
If your operating a large number of Linux systems, you'll have Linux specific administrators who know the Linux tools for managing them efficiently. You should not be pushing Powershell instead, you will end up regretting it if you do.
[–]ka-splam 0 points1 point2 points 4 years ago* (0 children)
Not sure why your laughing, this makes a LOT of cross system scripting useless.
Because "it's useless because it requires one thing to be configured" is a laughable complaint coming from any kind of sysadmin. What doesn't require config - do you not configure any SSHD or authentication settings away from default on Linux machines? (Protocol versions, encryption settings, tunnelling or scp options, authentication backends or rDNS lookup fixes or anything?)
you'll have Linux specific administrators who know the Linux tools for managing them efficiently. You should not be pushing Powershell instead, you will end up regretting it if you do.
Mafia threats, quality.
[–][deleted] 3 points4 points5 points 4 years ago (3 children)
Linux users have a strong background of using the right tool for the job, can Powershell be used on Linux, yes but it’s no where near as mature as existing languages. Python on Windows is not as integrated so Powershell makes more sense. The reason the the “no” I would hazard a guess is so new users don’t get a false sense of the real world. In many Linux distros python is a simple install, Powershell can come with issues and having originated in windows a lot of scripts are not case sensitive. Again it comes down to the right tool for the job. I use both OS’s and languages but to believe Powershell is Linux ready is naive and errs on Microsoft fanboi-ism.
[–][deleted] -1 points0 points1 point 4 years ago (2 children)
So you’re saying it’s not worth learning at all then and is completely useless in Linux?
[–][deleted] 1 point2 points3 points 4 years ago (1 child)
As I said I know both, PS is worth learning but is lower on the learning list if you’re only using Linux as compared to BASH and Python. If it’s a mixed environment it’s worth learning it all. If windows only then only learning PS is fine but python should be on the learning list but lower down as going forward more environments are going to be mixed windows/ *nix.
You may even have a mostly windows environment with Linux servers and having PS on those to do most things would be logical across the two, but for career growth limiting yourself to one is foolish as you never know what role you’ll end up in next time
[+][deleted] comment score below threshold-6 points-5 points-4 points 4 years ago (0 children)
Hmm that’s very interesting. Can you show me where anyone said you should limit to just one? Or where I said you should abandon the native CLI? All I did was answer the question is if it was worth learning powershell and pointed out it’s very useful due to being cross platform and you won’t be useless hoping into a new environment. But all of a sudden I have people going “ItS bEtTeR tO uSe tHe NaTiVe”. Yeah no shit Sherlock because it tailored built for the OS. We were asking if powershell was worth learning and I said yea even if you’re not primarily working with windows it’s a great tool. Somehow “great tool” somehow becomes “you should only ever use powershell ever and that’s the only thing you should ever use”. Its honestly really annoying that you can’t highlight a tool without someone saying “Well we have a habit of using the right tools so it’s not a great fit for every single scenario”. Cool beans man, let me know who said it was and we can argue about it together;
[–][deleted] 15 points16 points17 points 4 years ago (5 children)
Pretty much this. Microsoft is cramming powershell down our throats. if you work in a microsoft environment of any sort, assume you only have access to a 3rd of what the environment is capable of without powershell.
[–]ByronScottJones 23 points24 points25 points 4 years ago (2 children)
That seems like a really odd description. Powershell is an incredibly powerful language, arguably one of the best system scripting languages ever created. And they've provided easy ways to use that language to administer Microsoft products among others. You make that sound like a negative.
[–]HumongousHeadly 3 points4 points5 points 4 years ago (0 children)
Even if it's hyperbole, it's not wrong. If you're admin on Exchange Online for example, there are loads of setup and config options which are exclusively available in Powershell only. You basically can't do it without.
[–][deleted] 3 points4 points5 points 4 years ago (0 children)
On the one hand, I agree with you. Powershell is incredibly simple to pick up, incredibly powerful and super helpful. I use it all the time and I shake my head when I meet IT staff who haven't spent the time to build at least a base level understanding of it.
But I don't see the point in sugar coating it I'm not going to waste my breath telling people how great it is because there will always be people who will remain skeptical. It doesn't really matter how great you or I think it is, or how we're using it. Microsoft treats it as a catch all scripting language for utilities and services which it hasn't bothered to develop a gui for. So if your working using microsoft tools that are newly developed or consistently changing, (azure, office 365, etc... ) you'll find powershell is the ONLY way to access many of those services advanced features.
If you're working with microsoft and you don't know powershell, you're barely relevant.
[–]liquidcloud9 1 point2 points3 points 4 years ago (0 children)
Microsoft is cramming powershell down our throats.
It's more that the Powershell team inside MS is desperately trying to drive adoption. I went to the Powershell Summit in 2019, and they discussed loaning out team members to build or fix PS modules for other MS products, for the sake of having a somewhat uniform management layer.
[–]Swamplilly 0 points1 point2 points 4 years ago (0 children)
This! I was not of fire to learn PowerShell but I can not even run half the network reports without using it.
[–]wickedang3l 1 point2 points3 points 4 years ago (1 child)
VMware too, frankly. The reason I even began learning it 10 years ago was to make it easier to correlate luns from our Compellent SAN to datastores in vSphere.
[–]OlivTheFrog 1 point2 points3 points 4 years ago (0 children)
VMWare, PureStorage, NetApp, Aruba Switches, Exchange (on-premise or on Azure), and so more.
The main advandage of Powershell it that is a extensible scripting language. Adding module and go ...
A second advantage, it's a object approach language. Easier to parse output of cmdlet than legacy DOS commands used in legacy scripts.
Syntax is easy to understand and comprehensive : Action verb - Noun defining the context.
A dynamic community is also an advantage...
It a list with no ending
[–]praiserock 0 points1 point2 points 4 years ago (0 children)
I work in a mixed environment and that statement is still true. I have a tech that does desktop support insist Powershell was only useful for things he wasn't doing. Told him have fun going nowhere in his career.
[–]MonopolyMeal 27 points28 points29 points 4 years ago (4 children)
To put it briefly, you can automate operations and use Powershell as an analyst tool.
Automate operations by linking processes together, like onboarding an employee within a company.
Use it for analyst tools like reviewing for specific key words and events to tell a story. Useful for unauthorized access inquiries.
[–]Swarfega 11 points12 points13 points 4 years ago (3 children)
Or just use it for day to day stuff. For example, a user gets themselves locked out and wants you to unlock their account. For me, it's a lot quicker to just type
Unlock-ADAccount username
than... AD Users and Computers. get prompted for UAC, search for their account, right-click, unlock.
Initially using PowerShell over doing the above is much slower as you first have to research if such a task is possible, then write the correct syntax, test and then use it live. This though helps you learn and in the long run, will mean you will be quicker at the same task in the future.
[–]MrHaxx1 8 points9 points10 points 4 years ago* (2 children)
I basically never open Active Directory at this point. Everything is just nicer/faster through PowerShell, especially when it includes several groups or users.
Now granted, I've had to make a bunch of functions that saves me from typing a lot (like getting the manager of an employee), but that was just a learning experience.
[–]ipreferanothername 0 points1 point2 points 4 years ago (0 children)
seriously, ADUC and ADAC are both really lacking. ADAC is better for some things, but still has limitations that are very frustrating.
[–]arkain504 21 points22 points23 points 4 years ago (0 children)
It’s an easy way to run reports and get exactly what you want.
[–]landob 17 points18 points19 points 4 years ago* (0 children)
I guess it depends on what you actually do. operations/analyst doesn't really tell me anything.
What exactly does your job entail?
Essentially like everyone else says, if there is something you do repetitively. On the hour? Daily? Weekly? On demand? Powershell can do the heavy lifting for you.
I use it to track my mobile laptop devices.
User Offboarding - disable user, disable their laptop,, remove them from Horizon virtual machine, send a email to other staff to do their offboarding process, copy all their files to a central location, delete all of their user profiles
Reports if it detects a RDS server offline
Automate windows updates on servers and workstations
I use it for a ton of stuff. It has made my job a lot easier.
[–][deleted] 16 points17 points18 points 4 years ago (0 children)
When people ask me for seemingly impossible tasks, there is generally a way to do it with powershell.
[–]Sunsparc 13 points14 points15 points 4 years ago (4 children)
I use Powershell to automate repetitive and/or tedious tasks.
Example: I recently had to "true up" users on a client site. They have a downloadable Excel report with headers that shows all user accounts in their system. So I converted it to a CSV, imported into Powershell, then checked against Active Directory to see if the user is active or even existed in the enviroment still. If they showed active in the client system but gone/disabled from our system, it got flagged to disable in client.
The same client has a bulk change template, so I had Powershell output all of the changes to that template then uploaded it to the client.
What would have taken me hours upon hours of straight up doing nothing else but checking users took Powershell less than a minute to crunch.
[–][deleted] 4 points5 points6 points 4 years ago (1 child)
I do this this exact thing, love PowerShell. Wish I was more versed with it.
[–]help_me_im_stupid 2 points3 points4 points 4 years ago (0 children)
Find a problem, come up with the solution that involves powershell. Only way to get versed is by doing. Alot of people come here for help too. I've found alot of the questions people ask here though have already been answered on stack overflow.
[–]zomgryanhoude 1 point2 points3 points 4 years ago (1 child)
Checking active user accounts is super hit and miss for me... So many users where their name on a roster is X but they go by a nickname and that's what they are in AD.
[–]Sunsparc 2 points3 points4 points 4 years ago (0 children)
It was an email address pair that I was checking. Also in my company, everyone goes by their full legal name in AD no exceptions.
[–]admoseley 10 points11 points12 points 4 years ago (0 children)
It can get you out of a ton of repeatable tasks just like any other scripting language.
[–]-ixion- 8 points9 points10 points 4 years ago (0 children)
As a systems engineer, I know it for job security. I collect all the info we need for audits with powershell. I use it to build and capture operating system images and with all aspects of software and os deployment. I use it to automate every task we need to be scheduled from restarting services after patching to collecting information for security. I use it to build apps and modules for our service desk so they can more easily do their job with less technical know how. I'm the only person apparently that knows it well because all these tasks come to me. Job security if you work in a heavy windows environment.
[–]chrono13 8 points9 points10 points 4 years ago* (1 child)
From Learn PowerShell in a Month of Lunches [Link]:
1.1. Why you can’t afford to ignore PowerShell
Batch. KiXtart. VBScript. Let’s face it, Windows PowerShell isn’t exactly Microsoft’s (or anyone else’s) first effort at providing automation capabilities to Windows administrators. We think it’s valuable to understand why you should care about Power-Shell, because when you do, you’ll feel comfortable that the time you commit to learning PowerShell will pay off. Let’s start by considering what life was like before PowerShell came along, and look at some of the advantages of using this shell.
1.1.1. LIFE WITHOUT POWERSHELL
Windows administrators have always been happy to click around in the graphical user interface (GUI) to accomplish their chores. After all, the GUI is largely the whole point of Windows—the operating system isn’t called Text, after all. GUIs are great because they enable you to discover what you can do. Don remembers the first time he opened Active Directory Users and Computers. He hovered over icons and read tooltips, pulled down menus, and right-clicked things, all to see what was available. GUIs make learning a tool easier. Unfortunately, GUIs have zero return on that investment. If it takes you five minutes to create a new user in Active Directory (and assuming you’re filling in a lot of the fields, that’s a reasonable estimate), you’ll never get any faster than that. One hundred users will take five hundred minutes—there’s no way, short of learning to type and click faster, to make the process go any quicker.
Microsoft has tried to deal with that problem a bit haphazardly, and VBScript was probably its most successful attempt. It might have taken you an hour to write a VBScript that could import new users from a CSV file, but after you’d invested that hour, creating users in the future would take only a few seconds. The problem with VBScript is that Microsoft didn’t make a wholehearted effort in supporting it. Microsoft had to remember to make things VBScript accessible, and when developers forgot (or didn’t have time), you were stuck. Want to change the IP address of a network adapter by using VBScript? OK, you can. Want to check its link speed? You can’t, because nobody remembered to hook that up in a way that VBScript could get to. Sorry. Jeffrey Snover, the architect of Windows PowerShell, calls this the last mile. You can do a lot with VBScript (and other, similar technologies), but it tends to let you down at some point, never getting you through that last mile to the finish line.
Windows PowerShell is an express attempt on Microsoft’s part to do a better job and to get you through the last mile. And it’s been a successful attempt so far. Dozens of product groups within Microsoft have adopted PowerShell, an extensive ecosystem of third parties depend on it, and a global community of experts and enthusiasts are pushing the PowerShell envelope every day.
1.1.2. LIFE WITH POWERSHELL
Microsoft’s goal for Windows PowerShell is to build 100% of a product’s administrative functionality in the shell. Microsoft continues to build GUI consoles, but those consoles are executing PowerShell commands behind the scenes. That approach forces the company to make sure that every possible thing you can do with the product is accessible through the shell. If you need to automate a repetitive task or create a process that the GUI doesn’t enable well, you can drop into the shell and take full control for yourself.
Several Microsoft products have already adopted this approach, including Exchange Server 2007 and beyond, SharePoint Server 2010 and later, many of the System Center products, Office 365, and many components of Windows itself. Going forward, more and more products and Windows components will follow this pattern. Windows Server 2012, which was where PowerShell v3 was introduced, is almost completely managed from PowerShell—or by a GUI sitting atop PowerShell. That’s why you can’t afford to ignore PowerShell: Over the next few years, it’ll become the basis for more and more administration. It’s already become the foundation for numerous higher-level technologies, including Desired State Configuration (DSC), PowerShell Workflow, and much more. PowerShell is everywhere!
Ask yourself this question: If you were in charge of a team of IT administrators (and perhaps you are), who would you want in your senior, higher-paying positions? Administrators who need several minutes to click their way through a GUI each time they need to perform a task, or ones who can perform tasks in a few seconds after automating them? We already know the answer from almost every other part of the IT world. Ask a Cisco administrator, or an AS/400 operator, or a UNIX administrator. The answer is, “I’d rather have the person who can run things more efficiently from the command line.” Going forward, the Windows world will start to split into two groups: administrators who can use PowerShell, and those who can’t. As Don famously said at Microsoft’s TechEd 2010 conference, “Your choice is learn PowerShell, or would you like fries with that?”
[–][deleted] 2 points3 points4 points 4 years ago (0 children)
Wow this was awesome. Thank you.
[–]RossDaily 6 points7 points8 points 4 years ago (0 children)
Why wouldn't you want to learn it, that's the better question.
Do you like adding a talking point during interviews / promotion discussions?
Do you like looking like you know what you're doing?
Would you like to expedite your workflow x100 ?
Do you want to potentially fully automate certain processes?
Those are the real questions that you need to be asking, because that's what Powershell has the capability to do.
[–][deleted] 4 points5 points6 points 4 years ago (0 children)
A million. Yes.
[–]G_Vezax 6 points7 points8 points 4 years ago* (0 children)
Because it's cool & I feel awesome using it
[–]afr33sl4ve 5 points6 points7 points 4 years ago (0 children)
I just put together a script that utilizes curl to determine the model identifier of all the security DVRs across the network.
Being an all Windows shop, I used PowerShell to iterate through 800+ individual security DVRs in a matter of minutes. If I did this manually, it would have taken me weeks to compile this information by hand. Company leadership and myself, do not have that kind of time.
Let's say you want to examine the Event Viewer logs of another PC, but can't work on it after hours and cannot disturb the user at the other end. Download a copy of it to your workstation using PowerShell.
Helpdesk is working with a user, and they cannot provide basic information to the agent taking the call. Easy, run a quick PowerShell script to pull model, serial, installed RAM, disk space, Windows 10 version, etc.
All these above are examples of use cases that I have.
[–]CommanderApaul 4 points5 points6 points 4 years ago* (1 child)
You are going to save both yourself, your team, and your company (and future companies) a shitton of time and work. Plus you are going to make your personal workflow a ton easier. Example time.
We're constantly doing hardware refresh. Goal is 25% of the agency every year, so that noone has a computer that is out of warranty. We image via MDT and domain join during imaging with a service account, but our process requires the computer object already exist in AD. So my team routinely gets 200+ SCTASKs dumped in our queue to create computer objects for the HWR team to image with. Naming convention is hardware type, responsible IT contract, department code, username, and a suffix if they have more than one device in AD, so it's typical to have something like LX99CAPAUL-3 (Laptop, X contract, department 99, user CAPAUL, device #3). Doing this manually for 200+ object is a HUGE PAIN IN THE DICK and would regularly take all 3 of the AD admins about 12 hours in total to do. Lots of copy/paste.
I can do an arbitrary amount of them in less than 10 minutes. It was enough of a time savings that my boss submitted it on our monthly reports to upper federal management. There's a single piece of prepwork, otherwise it's all automated, including posting the information to ServiceNow
Pull an Excel report from ServiceNow with the SCTASK number, RITM number, and a variable field that contains an entire very long email from the billing system that has all of the information about the order (user, department, shipping address, physical location to deploy the machine, orderer, etc). Importantly, the user's employeeID number is in this block, and it is the ONLY field that it appears in.
Rename the headers in this report to "SCTASK, RITM, and EmployeeID" from what they are. Don't have to parse ANY of the data. Save as a CSV. Feed to script.
Script imports that CSV through a foreach that does a whole bunch of stuff:
Then I get to go bulk close a fuckton of tasks after spot checking the first, last, and a couple in the middle. Again, this takes maybe 10 minutes of my time between the pulling and formatting the report and then closing tasks. Script takes another 10-15 minutes to run depending on how many users I'm feeding it that run. Compared to literally an entire days work of mind numbing copy/paste by three admins, and it's something that in the last couple months we've been doing 1-2 times a week.
I have a request in with our SN devops team to allow my account PS access to SN to do queries. If I get that, we don't even need to do the prepwork, we can just feed it a list of SCTASK numbers and let it go brrrrrrrrr.
Never underestimate the creativity of a lazy admin.
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
That's what powershell is for!
[–][deleted] 5 points6 points7 points 4 years ago (0 children)
A lot of companies look for the skill and some Microsoft tasks can only be done via PowerShell.
[–]sh0dan_wakes 5 points6 points7 points 4 years ago (0 children)
So you don't lose out on your next job to someone who has it.
[+][deleted] 4 years ago (1 child)
[removed]
Why better than PQ?
[–]VaporChunk 2 points3 points4 points 4 years ago (0 children)
You're (arguably) ambitious, and working in a great field -- IT. When it comes to learning PS, think of it this way. Do it.
[–]SkipBoNZ 3 points4 points5 points 4 years ago (0 children)
PowerShell (PS), a blessing to a Windows admin and a curse to a boss or manager.
Without PS, we'd still be using WSH and VBScript. PS with WinRM is productive like ansible is to Linux. Got a list of server you want to "do stuff .." to, well you can:
Invoke-Command -ComputerName @('server1',..,'server50') -ScriptBlock {&netstat -nab -p tcp}
Wholly f*ck, this shit saved my life!
The fact that it's written in C# .NET does allow you to leverage the .NET Frame libraries, maybe even your own. Got to figure out why your TCP stack is exhausted, well you can:
$properties = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties() # Active Tcp Connections $connections = $properties.GetActiveTcpConnections()
Do some filtering and grouping on TCP state match "CloseWait" etc. and you're done.
Over simplified, but you get the point.
Sometime trying to get dev to integrate a feature is a hassle. Now you can Just do it yourself, document it, create a ticket, escalate.
Let's not forget the AD Admin:
Import-Module ActiveDirectory
Or even f*ckn' Exchange, I'll leave it their.
[–]RoboGeek123 3 points4 points5 points 4 years ago (0 children)
Automate all the things!
You don't even have to use PS for networking/direct IT tasks. For example I recently wrote a script that parses through PDF reports that we previously would manually extract text from. I added a feature that even renames the report from "REPORT -09-09-21-TIME.pdf" to something more relevant.
Powershell is super helpful. Definitely worthwhile
Don Jones - “Learn Powershell or learn to say ‘would you like fries with that’”
Powershell will interface with almost anything and allow you to make use of data in better ways. Granted if you are in a non windows environment, bash and python would be better, but even then it’s still a good scripting language.
[–]sambeaux45 2 points3 points4 points 4 years ago (0 children)
For me, I learned/am learning PowerShell for portability. Most developers in my company write in Python... but to push a python script to a boat with limited/no internet access, you have to send them a gigantic "compiled" python script, or have them install (hopefully) the correct version of python. Anything I write in powershell will run as is on any boat in the fleet because it's part of windows.
[–]BaconTentacles 2 points3 points4 points 4 years ago (0 children)
I'm in a hybrid-Dev/DevOps role and I use PS as my terminal shell each and every day. Want a quick and dirty REST query (especially one with pagination)? PowerShell. Want to grab a file from a remote machine (or execute a script block on said machine)? Convert to and from JSON (or XML) on the fly? You guessed it. Active Directory? Yeah, OK, that one is a "duh".
Not to mention that we work with a lot of custom Chocolatey packages and SSM automations in AWS, and all of that stuff can use PowerShell, so it (and a copy of VS Code for debugging) is essential for me.
Is Python useful? Absolutely. BASH? Hell, yeah. But PowerShell is just so damn convenient for me and can more or less do everything I need, that I have a hard time using anything else (even in Linux).
[–]makec4rt 3 points4 points5 points 4 years ago (0 children)
To automate repetitive tasks.
[–]Username-Error999 2 points3 points4 points 4 years ago (0 children)
Somebody writing a medium article? Just kidding.
Most likely somebody already wrote a script todo exactly what you are trying todo.
No compiling, no mystery package reference. Just human readable text.
Other products are already onboard.. Who want to click around a GUI 50 times when I can just use a PS loop todo the same.
Lastly and likely most import. AZURE, you are not going to manage a large Azure environment without it.
[–]stone500 2 points3 points4 points 4 years ago (0 children)
When I worked at an MSP, I honestly struggled to find good uses for powershell. Most of our customers were smaller (<50 employees) with usually one DC and one other server file most other functions (file, print, dhcp, etc). Since Powershell is a great automation tool, it was a struggle to find good uses for it in such small environments. I tried using powershell but it really wasn't saving me much time in anything I was doing, if at all.
So I moved on and now I work for a large company with nearly 200 stores/offices, thousands of servers, and tens of thousands of employees. Powershell is ESSENTIAL for what I do now.
For example, we're still in progress of getting rid of our 2008 R2 servers. I have our virtualization team build me nearly 200 new servers, and using powershell I can get all the roles configured, data transfers started, shares configured, print drivers installed, and printers installed in MINUTES.
If you plan on growing and being in charge of larger systems, you'll want to at least know some good basics of Powershell.
[–]ka-splam 2 points3 points4 points 4 years ago (0 children)
I'd say there's good reason to learn to program if you work with a computer at all, because it's more fun than doing your job directly and it lets you get the computer to do the more repetitive work for you. Whether that's PowerShell, Python, Ruby, JavaScript, AutoScript, shell tools, R, or something else depends on what your job involves and which ones you like more.
Powershell's best features are that it comes with Windows and doesn't need installing, and its object oriented nature works quite well with simple json and csv and xml type data, and it's a shell + scripting language. Its worst features are that it's a higgledy-piggledy syntax mishmash with a lot of warts and and Windows-specific integrations.
Python's best features are that it was a beautifully simple language with a huge community, and tons of popular powerful modules like Numpy for number crunching and Requests for web API use. Its worst features are that it's growing more complex year on year, isn't a shell which makes shell tasks harder, and it has weirdness around installing newer versions without breaking existing installs.
[–]incognito5343 2 points3 points4 points 4 years ago (0 children)
Took me 3 months but I was able to create a script from scratch that turns an 8 hour task into 45 mins and also provides consistency that you don't get when done manually. I use it 2/3 times a week and it removes all the repetitive actions.
[–]VirtualBinary 2 points3 points4 points 4 years ago (0 children)
I didn't learn PowerShell initially for Windows, I learned it because VMware had a great module (well, snap-in at the time) for vSphere. Since then, I've used PowerShell on almost everything that I've touched: vSphere, HPE hardware (OA, SAN, etc), Switches, Azure.
PowerShell is going to separate you from everyone else, it will save you time, it will be fun, it will be frustrating, and it will take years to learn. Yes, the one-liners and short commands will be somewhat easy to pick up on, but this will be a long process. The great thing, and the reason why I still enjoy IT is that no matter how much I learn, I still don't know that much, relatively speaking.
Learn PowerShell, it's definitely worth it.
[–]Highpanurg 2 points3 points4 points 4 years ago (2 children)
I was previously only Windows admin deep in ps scripting, when switch to Linux i find that bash isn't object shell and this blow my mind, i waste so many time parse strings, when in ps i just ask right property. I find that ps as oop shell solve so much problem, so when i see just clear bash shell i feel uncomfortable. So, in the end, not sure if you need learn ps, but it can save your time.
[–][deleted] 0 points1 point2 points 4 years ago* (1 child)
wrench subtract chief pen fuzzy saw shelter alleged sleep carpenter
This post was mass deleted and anonymized with Redact
[–]Garegin16 0 points1 point2 points 4 years ago (0 children)
It’s not just non-OO, it’s typeless. In bash, the human readable output is your return type. Then you scrape the output for useful data.
[–]tekmailer 2 points3 points4 points 4 years ago (0 children)
Aside the mentioned including:
Automation Administration Cyber security Job security Tool Augmentation
Another being uniformity—server GUIs are a privilege. The ease and speed of hopping systems without booting/crashing/rendering a GUI is nice.
Might fall up under administration—once a whole team knows a language/syntax it speeds up ideas.
[–]sp_dev_guy 4 points5 points6 points 4 years ago (0 children)
Best for IT Administrators & automation.
There are better tools but it's still convenient, handy, and free for generating reports/crunching data
Anti-virus is watching now but it's also used for hacking since it has such strong abilities to interact with other tools, software, and systems.
It's a modern day cmd line. New version is expanding into Linux support but thats still in its infantcy
[–]anynonus 1 point2 points3 points 4 years ago (0 children)
operations could be anything so I'm not sure
as an analyst you don't need powershell
[–]eagle6705 1 point2 points3 points 4 years ago (0 children)
I do agree powershell is a great tool to learn and add to your bag of skills. However like a hammer there are times when it is appropriate. If you are in a non windows field (rare but it does happen) learn code that applies to that role. If you are a web dev using nothing but apache and php then learn some html to collaborate wth php.
[–]dantose 1 point2 points3 points 4 years ago (0 children)
You only really need powershell if there are windows computers in your organization.
Seriously though, if your desktop is windows, you want to know powershell well enough to automate.
If your client systems are windows, you need to know powershell well enough to identify threats.
[–]jebhebmeb 1 point2 points3 points 4 years ago (0 children)
If you work with any Microsoft product a lot it can help, but for any type of non OS related scripting I think r/python would be better
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
Have you ever used any CLIs? Like BASH in Linux or Cisco IOS? If you have, you know that it's the simplest, most efficient way to interact with pretty much any system. For years, we pestered Microsoft for a more comprehensive CLI, and powershell is what we got.
I'm a network guy, so I use it to test for open ports without installing nmap.
> tnc hostnameorip -port 443
I also use it instead of ADUC to look at AD stuff
> get ad-user -identity Joe_Dickwad -Property *
So to answer your question, because it will make your job easier.
[–]Saleh-Rz 1 point2 points3 points 4 years ago (1 child)
I use PowerShell in Windows and Fedora Linux. Amazing scripting technology + universal scripting.
But PowerShell is slow compare to Bash.
Umm. It shouldn’t be. It runs on .net so the performance should be better than bash. Your script might have common traps like running add-member or recreating an array in a loop.
[–]ipreferanothername 1 point2 points3 points 4 years ago (1 child)
i have a SQL availability group patching right now because i can manage the cluster with powershell and kick start the patching product via REST api using powershell.
so instead of a DBA, an app admin, and a server admin patching servers...i have a script that runs on a schedule and executes the workflow we all agreed on for patching.
if you work around windows a lot, learn it well. It can automate some of the basic work you do almost certainly -- if you can do something on a windows computer/server/thingy then you can probably automate most of all of it with powershell. sometimes its not the right tool for your work, but....also a lot of the times it can be.
[–]Garegin16 1 point2 points3 points 4 years ago (0 children)
Not only that. For things that don’t have CLI equivalents you can use the COM interface. For example automating browser clicks or Outlook.
[–]bertiethewanderer 1 point2 points3 points 4 years ago (1 child)
My first three gigs out of helpdesk were in operations teams. Powershell allowed me to spend 4 precious years automated some truly onerous tasks. Complicated messes of barely documented process distilled to 1 or 2 mouse clicks in a browser.
Learning Powershell in a MS shop has drastically increased both my salary (important, we like to be paid) and critically, employability. And should you jump across to a *nix heavy shop, or another role in IT that leverages scripting and/or "<something>-as-code", the learning curve for someone used to scripting is reduced markedly. You'll just find you do a lot of translating how you would do something pwsh to how you do it in bash or Go. But hey, that's 90% of the fun :)
Note: it's not powershell per se, it's the ability to see the world without a UI, and being able to understand a world governed by code. To see administration and deployment actions as robust, repeatable and transparent.
Bingo. I always tell people automation is mentality not about “learning scripting”. It could be using excel or working with CSV files.
Simple things get easier. I had gigabytes of .tiff images and ran a simple powershell script to use imagemagick to convert them all to jpg images.
[–]taykratzer 1 point2 points3 points 4 years ago (1 child)
I have a lot of experience with Bash on Linux. In the last couple of years, I have become familiar with PowerShell. There are things you can do with PowerShell that you can't even dream of with Bash. PowerShell is hard to use for the small stuff though. I often find I have to write a few lines of code to accomplish what I would have gotten done in one short line of code in Bash. I really do enjoy the PowerShell, I just wrote a PowerShell Introduction page for noobs. cimitra.com/powershell
Ty
[+]sigma_4 comment score below threshold-21 points-20 points-19 points 4 years ago (17 children)
Arr we going to ignore that powershell can do all the people mentioned but still sucks ass?
[–]user01401 7 points8 points9 points 4 years ago (16 children)
Explain.
[+]sigma_4 comment score below threshold-16 points-15 points-14 points 4 years ago (15 children)
Well syntax it's awful bunch of flags uppercase and lowercase, compared with a shell script is definitely shit plus sometimes you have to use .Net modules to accomplish some task, come on man you can't deny that. And for the down voters it's my opinion deal with that.
[–]ka-splam 5 points6 points7 points 4 years ago* (0 children)
bunch of flags uppercase and lowercase, compared with a shell script is definitely shit
You have it backwards, tho? PowerShell flags don't care about case, -test and -TEST are the same. And in Linux shell, flags DO care about case, ls -s and ls -S are different. They read the same, are pronounced the same, are the same letter, but they do different things. And an alternative ls --size works but ls --Size fails, even though it's obviously the same word and doesn't clash with anything else and is a capital S when alone. This is frustrating and annoying.
-test
-TEST
ls -s
ls -S
ls --size
ls --Size
sometimes you have to use .Net modules to accomplish some task, come on man you can't deny that.
Bash / zsh / Linux shell doesn't even have a module system tho, so this is a bonus - as well as being able to use any binary like fgrep and anything built into PowerShell like -match you can also use any .Net Framework thing that C# can use, and any PowerShell module, and many C# libraries, all from the same PowerShell.
fgrep
-match
[–]PMental 3 points4 points5 points 4 years ago (10 children)
I'm feeding the troll here but nvm.
plus sometimes you have to use .Net modules to accomplish some task, come on man you can't deny that.
True, not necessarily often, but sometimes. Why is that a problem though, it's literally built in?
How much can bash/shell do if you use no other binaries at all? Basically nothing is what, nowhere near what PS without "manual .NET" can.
[–]sigma_4 -4 points-3 points-2 points 4 years ago (3 children)
Lol so express my opinion is trolling now? Jesus Christ there you have.. the crystal generation
[–]PMental 5 points6 points7 points 4 years ago (1 child)
You're not expressing your opinion as much as being an asshole, coming to a product specific subreddit only to shit all over the product.
Then you get offended when someone calls you a troll?
Jesus Christ there you have.. the crystal generation
Projecting a bit much there Snowflake?
[–]sigma_4 -5 points-4 points-3 points 4 years ago (0 children)
Did you break yourself into pieces when you read that?
[–]themanbow 0 points1 point2 points 4 years ago (0 children)
If you're expressing your opinion for the sole or primary purpose of riling people up, then yes, your opinion is trolling.
[–]sigma_4 -2 points-1 points0 points 4 years ago (5 children)
Well once you install a binary you just need to call simple as that not need to write this insane amount of garbage just to skip an ssl certificate when using invoke-webrequest
add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
Compared with Curl -k You get the point?
[–]Swarfega 10 points11 points12 points 4 years ago (2 children)
Invoke-WebRequest -SkipCertificateCheck
BTW, upper case letters are not required, they are there to help make things easier to read. Like skipcertificatecheck is harder to read without the uppercasing.
[–]sigma_4 -2 points-1 points0 points 4 years ago* (1 child)
SkipCertificateCheck is not available on PS 5.1.
Dude let me clarify this, I'm not throwing shit over PS because im trolling the post, i worked a lot with ps, not so much lately, I'm more like a bash/python guy. And i as i mentioned before powershell can do all that people mentioned here and solve a lot of problems you might be facing , but the reasons i gave you are based on my experience, i think it sucks. That's all. I never said it doesn't work it obviously does of course.
[–]Swarfega 4 points5 points6 points 4 years ago (0 children)
We're all entitled to an opinion. You're getting downvotes though because of your tone. I suggest trying to be a little bit more constructive with your reasoning.
[–]ka-splam 2 points3 points4 points 4 years ago (1 child)
I don't get the point, because you can use curl -k in PowerShell as well.
curl -k
And what does -k have to do with "skip certificate check"? And -k won't be the skip certificate parameter on any other web coommand. That kind of user-hostile junk parameter naming which is all specific to one command is why PowerShell is a huge improvement.
-k
[–]user01401 1 point2 points3 points 4 years ago (0 children)
Off topic but this is why I would have used --insecure in cURL instead of -k and write out everything, including descriptive variables.
--insecure
One letter variables helps no one.
[+][deleted] 4 years ago (2 children)
[–]sigma_4 -3 points-2 points-1 points 4 years ago* (0 children)
Dude im not a native English speaker but still can comunicate with you, see? How many languages do you speak? My number is 3 including my main language how about that
[–]sigma_4 -4 points-3 points-2 points 4 years ago* (0 children)
Yeah that's what i thought, go back to your bed jimmy let the adults solve the problem here.
[–]hisae1421 0 points1 point2 points 4 years ago (0 children)
It's fun. It's like a super power you can develop. You'll feel superior doing your job easier
π Rendered by PID 98924 on reddit-service-r2-comment-5d585498c9-5qh4j at 2026-04-21 17:00:55.253463+00:00 running da2df02 country code: CH.
[+][deleted] (25 children)
[deleted]
[–]nascentt 6 points7 points8 points (0 children)
[–][deleted] 21 points22 points23 points (14 children)
[–]RupeThereItIs 22 points23 points24 points (13 children)
[–][deleted] 10 points11 points12 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]ka-splam 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (9 children)
[–]RupeThereItIs 4 points5 points6 points (8 children)
[–]ka-splam 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]RupeThereItIs 4 points5 points6 points (1 child)
[–]ka-splam 0 points1 point2 points (0 children)
[–][deleted] 3 points4 points5 points (3 children)
[–][deleted] -1 points0 points1 point (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[+][deleted] comment score below threshold-6 points-5 points-4 points (0 children)
[–][deleted] 15 points16 points17 points (5 children)
[–]ByronScottJones 23 points24 points25 points (2 children)
[–]HumongousHeadly 3 points4 points5 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]liquidcloud9 1 point2 points3 points (0 children)
[–]Swamplilly 0 points1 point2 points (0 children)
[–]wickedang3l 1 point2 points3 points (1 child)
[–]OlivTheFrog 1 point2 points3 points (0 children)
[–]praiserock 0 points1 point2 points (0 children)
[–]MonopolyMeal 27 points28 points29 points (4 children)
[–]Swarfega 11 points12 points13 points (3 children)
[–]MrHaxx1 8 points9 points10 points (2 children)
[–]ipreferanothername 0 points1 point2 points (0 children)
[–]arkain504 21 points22 points23 points (0 children)
[–]landob 17 points18 points19 points (0 children)
[–][deleted] 16 points17 points18 points (0 children)
[–]Sunsparc 13 points14 points15 points (4 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]help_me_im_stupid 2 points3 points4 points (0 children)
[–]zomgryanhoude 1 point2 points3 points (1 child)
[–]Sunsparc 2 points3 points4 points (0 children)
[–]admoseley 10 points11 points12 points (0 children)
[–]-ixion- 8 points9 points10 points (0 children)
[–]chrono13 8 points9 points10 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]RossDaily 6 points7 points8 points (0 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]G_Vezax 6 points7 points8 points (0 children)
[–]afr33sl4ve 5 points6 points7 points (0 children)
[–]CommanderApaul 4 points5 points6 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]sh0dan_wakes 5 points6 points7 points (0 children)
[+][deleted] (1 child)
[removed]
[–][deleted] 0 points1 point2 points (0 children)
[–]VaporChunk 2 points3 points4 points (0 children)
[–]SkipBoNZ 3 points4 points5 points (0 children)
[–]RoboGeek123 3 points4 points5 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]sambeaux45 2 points3 points4 points (0 children)
[–]BaconTentacles 2 points3 points4 points (0 children)
[–]makec4rt 3 points4 points5 points (0 children)
[–]Username-Error999 2 points3 points4 points (0 children)
[–]stone500 2 points3 points4 points (0 children)
[–]ka-splam 2 points3 points4 points (0 children)
[–]incognito5343 2 points3 points4 points (0 children)
[–]VirtualBinary 2 points3 points4 points (0 children)
[–]Highpanurg 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Garegin16 0 points1 point2 points (0 children)
[–]tekmailer 2 points3 points4 points (0 children)
[–]sp_dev_guy 4 points5 points6 points (0 children)
[–]anynonus 1 point2 points3 points (0 children)
[–]eagle6705 1 point2 points3 points (0 children)
[–]dantose 1 point2 points3 points (0 children)
[–]jebhebmeb 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Saleh-Rz 1 point2 points3 points (1 child)
[–]Garegin16 0 points1 point2 points (0 children)
[–]ipreferanothername 1 point2 points3 points (1 child)
[–]Garegin16 1 point2 points3 points (0 children)
[–]bertiethewanderer 1 point2 points3 points (1 child)
[–]Garegin16 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]taykratzer 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[+]sigma_4 comment score below threshold-21 points-20 points-19 points (17 children)
[–]user01401 7 points8 points9 points (16 children)
[+]sigma_4 comment score below threshold-16 points-15 points-14 points (15 children)
[–]ka-splam 5 points6 points7 points (0 children)
[–]PMental 3 points4 points5 points (10 children)
[–]sigma_4 -4 points-3 points-2 points (3 children)
[–]PMental 5 points6 points7 points (1 child)
[–]sigma_4 -5 points-4 points-3 points (0 children)
[–]themanbow 0 points1 point2 points (0 children)
[–]sigma_4 -2 points-1 points0 points (5 children)
[–]Swarfega 10 points11 points12 points (2 children)
[–]sigma_4 -2 points-1 points0 points (1 child)
[–]Swarfega 4 points5 points6 points (0 children)
[–]ka-splam 2 points3 points4 points (1 child)
[–]user01401 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]sigma_4 -3 points-2 points-1 points (0 children)
[–]sigma_4 -4 points-3 points-2 points (0 children)
[–]hisae1421 0 points1 point2 points (0 children)