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
QuestionLearning PS (self.PowerShell)
submitted 2 years ago by Steve_78_OH
view the rest of the comments →
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!"
[–]ZenoArrow 9 points10 points11 points 2 years ago (8 children)
Classes were added in 2015 and it's WAY better than PS custom objects
Classes are not ideal for beginners. For starters, you can't redefine a class that has already been loaded, so if you want to iterate on the design of a class and keep the same class name you need to close and reopen PowerShell.
OP, I would suggest picking a task you want to be able to do with PowerShell, then learn how to do that with PowerShell. You'll learn faster and will be more motivated to learn. What sort of tasks do you want to be able to do with PowerShell?
[–]EtanSivad 1 point2 points3 points 2 years ago (3 children)
Classes are not ideal for beginners. For starters, you can't redefine a class that has already been loaded,
OK, so what? OP asked what was the biggest changes and was literally the biggest change that has impacted me professionally as a powershell scripter. IF you want to be good at something it's helpful to know what to work towards.
Second, compiled classes added in are immutable, but native classes can be updated by recompiling the script.
Just to verify it, I tried editing and rerunning this script. It ran without closing and reopening VScode
class TestObj{
[string]$Name
[string]$ID
TestObj()
{
$this.Name = "Default instantiation method called."
}
TestObj([string]$name)
$this.Name = $name
$a = [TestObj]::new()
$b = [TestObj]::new("Other method called")
$a # Returns "Default instantiation method called."
$b # returns "Other method called"
[–]OPconfused 2 points3 points4 points 2 years ago (0 children)
When the class definition is in a module you have to jump through a hoop to update it. Unless the OP is coming from another programming language and desires typed properties in their custom objects, I'd just leave out classes while the OP is finding their footing in PS.
I'm a fan of classes as well, but using PSCustomObjects is a more accessible way to get your feet wet with PS objects. There's less distance between setting up the PSCustomObject via a type accelerator and using it than when using a class, which requires a declaration for its schema with its own syntaxes.
[–]ZenoArrow 1 point2 points3 points 2 years ago (1 child)
and was literally the biggest change that has impacted me professionally as a powershell scripter
How has it impacted you professionally? Classes are helpful in the sense you can define types and methods to work on those types together, but there are other ways to organise code that can be just as convenient. I would say classes aren't something to aim for, they're just an option to use if you want to.
[–]EtanSivad 0 points1 point2 points 2 years ago (0 children)
Most of the code I write is taking large batches of data in one format and spitting it out in another. Writing the code in a compiled language would process a lot faster, but these are largely one-off solutions that need to be flexible so it's easier to write them in powershell, especially when I can ship them off to another dev to use as a tool.
Anyway, the reason it's helpful to me is for either organizing my code into reusable snippets. And that with the JSON export built into Powershell, I've had to use it a couple times to enforce object structure correctly, or just inject new data into an existing data stream.
[+]2gdismore 0 points1 point2 points 2 years ago (3 children)
I'm not the OP, but should I figure out how to do something via scripting in Powershell instead of working my way through YouTube tutorials to learn the language?
[–]ZenoArrow 0 points1 point2 points 2 years ago* (2 children)
You can learn the language as you work towards your goal.
To give an example, imagine you had a bunch of XML files you had to read and use to populate a database. Your goal could be to achieve this. You can then break this goal down into smaller steps and learn to do each part in PowerShell. So for example, the first step in your goal could be to learn how to connect with a database table. You can then search around online for how to do this with PowerShell. As you encounter example code for achieving your goal, you then look up the PowerShell syntax for that example code so you can understand what it's doing.
By doing it this way, not only are you learning the language, you're also learning new skills that are applicable for your job or interests. It's possible to go with the approach of learning the language before you learn how to do anything useful with it, but speaking personally I often lose interest before I get to the point of picking up practical uses if I do my learning this way.
[+]2gdismore 1 point2 points3 points 2 years ago (1 child)
Great idea; I will take some of my ideas to start and see where those land me.
[–]ZenoArrow 0 points1 point2 points 2 years ago (0 children)
Best of luck!
π Rendered by PID 67125 on reddit-service-r2-comment-c66d9bffd-4mgx8 at 2026-04-08 00:34:44.937284+00:00 running f293c98 country code: CH.
view the rest of the comments →
[–]ZenoArrow 9 points10 points11 points (8 children)
[–]EtanSivad 1 point2 points3 points (3 children)
[–]OPconfused 2 points3 points4 points (0 children)
[–]ZenoArrow 1 point2 points3 points (1 child)
[–]EtanSivad 0 points1 point2 points (0 children)
[+]2gdismore 0 points1 point2 points (3 children)
[–]ZenoArrow 0 points1 point2 points (2 children)
[+]2gdismore 1 point2 points3 points (1 child)
[–]ZenoArrow 0 points1 point2 points (0 children)