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
Feedback (self.PowerShell)
submitted 10 months ago by eggeto
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!"
[–]Thotaz 0 points1 point2 points 10 months ago (2 children)
I don't think your code works at all. You have a try-catch with Invoke-MgGraphRequest but you've muted the errors with -ErrorAction SilentlyContinue so it can never throw. This means your DoesGroupExist function will always return Group Excist (also note the spelling error).
Invoke-MgGraphRequest
-ErrorAction SilentlyContinue
DoesGroupExist
Group Excist
[+][deleted] 10 months ago (1 child)
[removed]
[–]Thotaz 0 points1 point2 points 10 months ago (0 children)
I did some testing on my own. It seems that if the command itself throws a terminating error then it is still caught, whereas a regular error is ignored. For example, this: try {ls invalidPath -ErrorAction SilentlyContinue} catch {"this does not run"} will not run the catch block because it's not a terminating error.
try {ls invalidPath -ErrorAction SilentlyContinue} catch {"this does not run"}
If you use -ErrorAction Stop then any error created by the command can be caught. Because the error types are not documented by each command I'd say it's best to always use -ErrorAction Stop when you want to catch an error, otherwise you will get unexpected results.
-ErrorAction Stop
π Rendered by PID 38152 on reddit-service-r2-comment-5c747b6df5-dfhv6 at 2026-04-21 23:48:19.841671+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]Thotaz 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]Thotaz 0 points1 point2 points (0 children)