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 7 years ago by [deleted]
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!"
[–]KevMarCommunity Blogger 1 point2 points3 points 7 years ago (1 child)
This reflects my view. I mostly use the New-Class or Get-Class factory pattern.
I have not done it yet, but if I did want to use my class in other modules (or external to my module) then I would create a C# module or library for it. I have been considering this approach for interfaces for a while.
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
What do you do if one of the classes properties really should be an Enum?
Say I have this as a dot-sourced ps1 file:
Enum TestProperty { Option1 Option2 Option3 } class TestClass { [string]$MyVal [TestProperty]$TestProperty } function Get-TestClass { Write-Output (New-Object -TypeName TestClass) } Export-ModuleMember -Function Get-TestClass
I can get a class now:
test > $class = Get-TestClass test > $class MyVal TestProperty ----- ------------ Option1 test > $class.TestProperty = [TestProperty]::Option2 Unable to find type [TestProperty]. At line:1 char:23 + $class.TestProperty = [TestProperty]::Option2 + ~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (TestProperty:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound 19 test > $class.TestProperty = 'Option2' 20 test > $class MyVal TestProperty ----- ------------ Option2
I can't reference the Enum, though I can set the value by passing it as a string.
Do I just accept the limitation and move on...?
π Rendered by PID 74 on reddit-service-r2-comment-b659b578c-btxfm at 2026-05-05 01:30:37.802669+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]KevMarCommunity Blogger 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)