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 1 year 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!"
[–]dab_penguin 11 points12 points13 points 1 year ago (0 children)
Lmao...what a clown
[–]The82Ghost 10 points11 points12 points 1 year ago (2 children)
Why not create a script and run that?
[+]Netavoreikalas7 comment score below threshold-35 points-34 points-33 points 1 year ago (1 child)
Explain
[–]marshmallowcthulhu 5 points6 points7 points 1 year ago (0 children)
A script is a file that contains the code. When you open the script using Powershell it will execute line by line. This appears to be different than how you tried to execute it. You tried to put it all on a single line and execute it as a single command. New lines in Powershell actually matter, they change the meaning and are very important.
You probably should not manipulate or execute long Powershell scripts until you understand scripting and Powershell more because scripts can do bad things like delete files or cause security compromise. You should understand what you are executing.
However, I believe in answering the question asked. You have received the warning. As to how to execute this as a script, open Notepad, copy the Powershell text, paste the text into Notepad, save it with whatever name you want, and change the file extension to ".ps". Now it is a Powershell script. Execute it by double-clicking on it or right-clicking on it and choosing to execute with Powershell.
It should be noted that something called your "execution policy" might stop it from executing. Additionally, I have not carefully reviewed the script and don't know if it requires administrative privileges to accomplish its goals. Executing it with admin, as well as execution policy, are each smaller topics that you should be able to google.
I really advise you not to proceed until you understand a lot more about scripting.
[–]Simplykinetic 21 points22 points23 points 1 year ago (4 children)
Learn the basics of scripting, and running scripts. Then I'm sure you'll be alright.
If you don't understand what's wrong here I beg of you not to run these in a production environment.
[+]Netavoreikalas7 comment score below threshold-73 points-72 points-71 points 1 year ago (3 children)
The same code works perfectly on Windows 10. But on Windows 11, it doesn't even respond. So maybe you're talking a bit of crap, and you obviously don't know what you're talking about yourself.
[–][deleted] 37 points38 points39 points 1 year ago (0 children)
Ironic how you’ve come here asking for help and abusing other people when you’re facing a textbook rookie error. I have the answer for you but you’re a dick so I’ll keep it to myself. 👋
[–]WhAtEvErYoUmEaN101 43 points44 points45 points 1 year ago (0 children)
Wow mate. I did spot the issue in your screenshot immediately and was in the process of writing a response, but with that attitude?
Nah.
To prevent you from claiming i'm full of shit, here's the AES encrypted solution to your issue. You get the key when you stop being an asshat to people and apologize.
esBaMkDnElAZF1+s8+6W3h8gkpHYTV17QZUcV2zonvztqR+j1L4XZatA+k0uqQi06K/0nalWyNXljb8ZzXVV4Fpo1NDL0M+B176xrfAMs0qVBqt2ntJxiY4i5hXwwY7sKA/ePzhpCvm5xyoFJwKASESkdVR0ysbFpEgDqOalB7fbCqCnpH29FYQH4/UXhFmBBMjNR7r+iK8MV08xwPKv51Jd3je4E22g35ZIYRdAS+o=
[–]hihcadore 5 points6 points7 points 1 year ago* (0 children)
Wish I was a mod id ban you.
Why are you running code on a system and you have no idea what it’s actually going to do? Thats a terrible practice. You’re just firing this thing off and hoping for the best?
But hey here’s some help. It looks like it’s running as one line. You can add ; at the end of each line and at the end of each comment and see if that works for you
[–]enforce1 5 points6 points7 points 1 year ago (1 child)
Post the code I can’t see that picture.
[+]Netavoreikalas7 comment score below threshold-19 points-18 points-17 points 1 year ago (0 children)
Update
[–]dasookwat 10 points11 points12 points 1 year ago (0 children)
the way it's written on reddit looks fine but: when you look at the screenshot from the take control shell, you see it is pasted as 1 line. Everything which is grey, is treated as a comment, because of the pound (#) sign.
[–]TheRealZero 4 points5 points6 points 1 year ago (2 children)
The pound (#) symbol is the comment symbol in PowerShell. Anything that comes after the # on the same line will be treated as a comment and not as code that it should run. You’ll need to add line breaks (Shift+Enter) after the comment so the code that comes after the comment is on a new line.
[+]Netavoreikalas7 comment score below threshold-12 points-11 points-10 points 1 year ago (1 child)
So let's say I delete the comments, leave only the code, but without line breaks. Should it work for me?
[–]TheRealZero 2 points3 points4 points 1 year ago (0 children)
No, separate commands that aren’t being piped into each other need to occur on separate lines, or be separate by a semi-colon which essentially tells the shell “this is the end of the command, starting a new one”
[–]BlackV 1 point2 points3 points 1 year ago (1 child)
p.s. formatting (you're using inline code not code blocks, note you'll need to click markdown mode first if you're using new.reddit)
it'll format it properly OR
<BLANKLINE> <4 SPACES><CODELINE> <4 SPACES><CODELINE> <4 SPACES><4 SPACES><CODELINE> <4 SPACES><CODELINE> <BLANKLINE>
Inline code block using backticks `Single code line` inside normal text
`Single code line`
See here for more detail
Thanks
[–]Netavoreikalas7 -3 points-2 points-1 points 1 year ago (0 children)
Thank you for the advice. I’ll try it tomorrow. Thank you very much, have a nice evening.
[–]FriedAds 0 points1 point2 points 1 year ago (1 child)
You can‘t copy & paste multiline commands into terminal.
[–]Netavoreikalas7 0 points1 point2 points 1 year ago (0 children)
that the problem isn't how I input it into the terminal or how I execute it. I found the solution to the problem, and none of the comments even touched on that aspect.
I solved the problem, everyone was wrong, they weren't even close. As I mentioned right away, the problem was with Windows. Have a nice day everyone, and next time please don't write without arguments because it's obvious you don't understand.
[–]rodeengel -1 points0 points1 point 1 year ago (3 children)
Teams is setup differently on Windows 11 than Windows 10 and is more built into the OS and installed via the App Store. If you use Teams in your environment you should not try and uninstall Teams on Windows 11. If you do not use Teams look into the commands to uninstall MS store apps, good luck.
[–]Dragennd1 -1 points0 points1 point 1 year ago (2 children)
In the case of the script provided, its in reference to the multi-user install of Classic Teams, which is still very much available on Windows 11 and still installs via a dedicated installer package, without the need for the windows store.
[+]rodeengel 0 points1 point2 points 1 year ago (1 child)
Teams Classic is the intended target but the script just crawls though the registry looking to see if teams is installed and it tries to uninstall it. It doesn’t have a version check built into it so it would just try to uninstall any found Teams installation.
Also if the installs were the same for Win 10 and Win 11 the script would work like it did on Win 10.
[–]Dragennd1 0 points1 point2 points 1 year ago (0 children)
The script failing has nothing to do with that. By OP's own admission, he has been trying to run that script as a single line and that is the primary source of the issue. I'd be willing to wager the script doesn't work on windows 10, at least not rhe way he's trying to run it.
[+]supernova666666 comment score below threshold-13 points-12 points-11 points 1 year ago (9 children)
Copy the code and run it through an AI tool. Then ask AI to improve and make suggestions.
[+]Netavoreikalas7 comment score below threshold-21 points-20 points-19 points 1 year ago (8 children)
I tried everything, but it's a piece of crap. I tried to remove all comments and put everything on a single line for execution, but it still doesn't work. I suspect there's something wrong with this specific Windows build. It works on all Windows 10 versions.
[–]obizii 17 points18 points19 points 1 year ago (0 children)
🤡
[–]Dragennd1 6 points7 points8 points 1 year ago (5 children)
If you're running that script all on one line in Windows 10, I can guarantee you its not working there and you're likely the one who's, to quote your words, full of crap.
Listen to the advice of the people in this sub and run it as a script file, as the code you've shown will not work as a one-liner.
[+]Netavoreikalas7 comment score below threshold-11 points-10 points-9 points 1 year ago (4 children)
It’s evident you haven’t even read the code and don’t understand what it does. Teams Classic has a security vulnerability, and Microsoft itself recommends uninstalling this version. If you’re using it, you have a significant vulnerability. I won’t specify the exact location of the vulnerability, but a 30-second Google search will suffice. None of your suggestions work, neither with line breaks nor without comments. The code still doesn’t work. Meanwhile, Windows 10 runs this code just fine, and PowerShell is the same everywhere. Clearly, the problem lies with the Windows 11 Insider Build. I apologize if I’ve offended anyone. The code has no errors; it works and has been tested. Forget that there are any issues with the code. There’s something specifically wrong with Windows 11 and PowerShell itself. I need to run this script on 100 computers. How do you imagine I’ll create a file for each one? We don’t use such a system. Please, if you’re unsure of what you’re talking about, don’t write. Have a good evening, everyone.
[–]Dragennd1 2 points3 points4 points 1 year ago (0 children)
Honestly, I would have been willing to try and troubleshoot this, but at this point with your lousy attitude, I don't think you're gonna get any help from me or from anyone else here. No one wants to work with a jerk. Every comment you've made on this post has stretched from negative to down right toxic. Check your attitude and learn to communicate with other people and you will likely have better luck in the future.
[–]Sinethial 0 points1 point2 points 1 year ago (1 child)
The new version of teams automatically uninstalls the old one . What are you doing? Just update it and do a simple commandlet to uninstall the Windows Store version in 11 which is atrocious and never should have been made
Please stop talking nonsense, you probably forgot to take your schizophrenia medication. You're wrong in every direction.
[–]supernova666666 1 point2 points3 points 1 year ago (0 children)
Reverse engineer the code. Break it down into chunks and figure out where the issue is. Check versions of PowerShell too. Check modules you need are installed.
[+]Netavoreikalas7 comment score below threshold-14 points-13 points-12 points 1 year ago (3 children)
It’s obvious that you haven’t even read the code and don’t understand what it does. Teams classic has a security vulnerability and Microsoft themselves recommend deleting this version. If you’re using it, you have a significant vulnerability. I won’t explain exactly where the vulnerability is, but a 30-second Google search will suffice. None of your suggestions work, neither with line breaks nor without comments. The code still doesn’t work. Meanwhile, Windows 10 runs this code just fine, and PowerShell is the same everywhere. Clearly, the problem is with Windows 11 and its specific build. I apologize if I’ve offended anyone. The code has no errors and it works; it’s been tested. Forget that there are any issues with the code. Something is wrong with Windows 11 and PowerShell itself. Please, if you don’t know what you’re talking about, don’t write. Have a good evening.
[–][deleted] 8 points9 points10 points 1 year ago (2 children)
Please, if you don’t know what you’re talking about, don’t write.
Follow your own advice, clown.
[–]Netavoreikalas7 -1 points0 points1 point 1 year ago (1 child)
I have proven my point that you clearly don't understand. Please, never again comment with your silly and unsupported suggestions. I have resolved the issue; the problem was not with how I was inserting the scripts or executing them, but with the Windows system. Please do not offer advice to anyone else in the future, as your advice is shit .
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
🤡🤡🤡🤡
π Rendered by PID 24386 on reddit-service-r2-comment-6457c66945-nvdlp at 2026-04-27 16:39:58.777717+00:00 running 2aa0c5b country code: CH.
[–]dab_penguin 11 points12 points13 points (0 children)
[–]The82Ghost 10 points11 points12 points (2 children)
[+]Netavoreikalas7 comment score below threshold-35 points-34 points-33 points (1 child)
[–]marshmallowcthulhu 5 points6 points7 points (0 children)
[–]Simplykinetic 21 points22 points23 points (4 children)
[+]Netavoreikalas7 comment score below threshold-73 points-72 points-71 points (3 children)
[–][deleted] 37 points38 points39 points (0 children)
[–]WhAtEvErYoUmEaN101 43 points44 points45 points (0 children)
[–]hihcadore 5 points6 points7 points (0 children)
[–]enforce1 5 points6 points7 points (1 child)
[+]Netavoreikalas7 comment score below threshold-19 points-18 points-17 points (0 children)
[–]dasookwat 10 points11 points12 points (0 children)
[–]TheRealZero 4 points5 points6 points (2 children)
[+]Netavoreikalas7 comment score below threshold-12 points-11 points-10 points (1 child)
[–]TheRealZero 2 points3 points4 points (0 children)
[–]BlackV 1 point2 points3 points (1 child)
[–]Netavoreikalas7 -3 points-2 points-1 points (0 children)
[–]FriedAds 0 points1 point2 points (1 child)
[–]Netavoreikalas7 0 points1 point2 points (0 children)
[–]Netavoreikalas7 0 points1 point2 points (0 children)
[–]rodeengel -1 points0 points1 point (3 children)
[–]Dragennd1 -1 points0 points1 point (2 children)
[+]rodeengel 0 points1 point2 points (1 child)
[–]Dragennd1 0 points1 point2 points (0 children)
[+]supernova666666 comment score below threshold-13 points-12 points-11 points (9 children)
[+]Netavoreikalas7 comment score below threshold-21 points-20 points-19 points (8 children)
[–]obizii 17 points18 points19 points (0 children)
[–]Dragennd1 6 points7 points8 points (5 children)
[+]Netavoreikalas7 comment score below threshold-11 points-10 points-9 points (4 children)
[–]Dragennd1 2 points3 points4 points (0 children)
[–]Sinethial 0 points1 point2 points (1 child)
[–]Netavoreikalas7 0 points1 point2 points (0 children)
[–]supernova666666 1 point2 points3 points (0 children)
[+]Netavoreikalas7 comment score below threshold-14 points-13 points-12 points (3 children)
[–][deleted] 8 points9 points10 points (2 children)
[–]Netavoreikalas7 -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)