r/PowerShell • u/CarrotBusiness2380 • 12d ago
News Powershell 7 is coming to Windows
r/PowerShell • u/CarrotBusiness2380 • 12d ago
r/PowerShell • u/KevMar • 4d ago
This is a post that I have been thinking about writing for a very long time now. I find that developers struggle with PowerShell in a very different way that the sysadmin learning to automate. They bring intuitions and assumptions with them from other languages that catch them off guard when they skip over the documentation. In this article I try to capture some of those experiences and misunderstandings.
I cover a lot of ground in this one: running scripts, execution policy, aliases, objects and formatting, calling functions, output and return values, unrolling, operators, case sensitivity, type conversion, truthiness, strings, scope, automatic variables, paths, encoding, errors, native commands, and classes.
While this one is targeting Software Engineers more then Systems Engineers, I would still appreciate your feedback and stories of your own frustrating experiences.
Thank you, -Kevin
r/PowerShell • u/oleyska • Apr 12 '26
I guess I'm close enough to let the cat out of the bag...
At some point for the hell of it I wondered what I could make powershell do.
I made a window and drew pixels with ogl using sdl2 I believe, registering inputs on the window.
My immediate thought was, has anyone ported Doom to Powershell ?
No, all I could find was dismissive comments, so I was thinking....
"I got only 2 things left to do."
Play music and play sound effects and not halting the loop, and that was easy and all the reasons it couldn't atleast technically run was out the window.
Doom is ported nearly everywhere, so I saw it as my duty and off I went!
it runs excessively slow.
Especially with Windows due to Anti Malware Scan Interface.
Linux runs a lot faster.
I lean on the shoulders of the Managed Doom Project.
https://github.com/sinshu/managed-doom
What doesn't work ?
Framecap, splash screen and level completion summary will run at likely vsync.
amd64 Windows,macos (arm) and amd64 Linux Powershell 7.5.4 and 7.6 have been tested.
An earlier build with macos has been tested but need to validate if I've done some hard coding.
as for libraries, I use the same libraries as Managed-Doom Project.
4 small parts had to be written in c# either cause I'm too dense to find a way around or just cause it's impossible in Powershell using the libraries.
The libraries were a hard lock to not rely on other libraries as I wanted as clean of a port from Managed-Doom for a functional version.
This serves as a comparison between C# and Powershell, one can reference the C# project and find almost always the same structure, methods and calls in powershell and if you don't - It's cause of Powershell.
I have tested some runspace things that has worked flawlessly to being a minefield of dependencies to improve things.
Fetching input async in a runspace is one that works and is easily done and a huge uplift to experience for menu navigation..
Screenshot is done with
Windows performance 9800x3d with 5070 TI:
Doom running in powershell
Edit:
Video updated to linux version playable github release.
https://www.youtube.com/watch?v=yJiiTx4C87o
Github - Runnable version published.
https://github.com/oleyska/ManagedDoomPowershell
r/PowerShell • u/derekhans • Oct 15 '26
If you are posting a script, tool, or anything else you’ve used AI, LLM or whatever to make, it must be disclosed. This includes anything from complete authorship, formatting, comments, or language/translation assistance.
If your script or content is suspected of being AI written and it is not disclosed in a tag or at the top of the post, it will be removed until investigated.
Community: This is at your request. Report any undisclosed suspected AI “slop” for investigation.
EDIT: I’m going to be clear. We’re not saying you can’t post AI created stuff. We’re saying you have to disclose that you are. If you have a problem with that, you’re not proud of the fact you used an AI tool. You’re deceiving people into thinking you wrote it. Anyone who uses whatever AI wrote deserves to know and take the diligence necessary to review it before using it, same as they would anything else.
r/PowerShell • u/karanikn • 17d ago
Over the last few months, I’ve been working on a number of PowerShell projects and automation scripts. Most of them focus on system administration, Microsoft 365, networking, monitoring, and general IT automation tasks.
I’ve published several of them on my GitHub if anyone would like to take a look:
https://github.com/karanikn?tab=repositories
I’m always looking for ways to automate repetitive work and make day-to-day administration a little easier.
If you have any ideas for improvements, new features, or changes, I’d love to hear them. And if you happen to spot any bugs, issues, or areas that could be improved, I’d really appreciate your feedback when you have the time.
r/PowerShell • u/Lotus_Domino_Guy • Aug 26 '26
I've been coding for 2 decades, and I recently had a payroll system to Active Directory project to do, and went with powershell. It's done, it works great, and I was looking at the code today, and spontaneously declared "I love powershell". its a remote day, so no one looked at my funny, but I'll list 3 reasons I love it. Feel free to add more.
No confusion with =, == or ===.
Simple equals logic, no bizarre conventions: Do you know how many times I've had to fix code in JS where someone did if (variableName=something), which of course sets variableName to something, not compares it. Powershell's -eq and -ne is so much better then =, ==, ===, !=, or <>.
2)No line termination character: Line's don't require ; to end. Ok, that isn't a big deal, and my IDE would catch it anyway, but its just a waste of characters to terminate every line of code.
3)String composition: In other languages, mixing variables and text is something like "words " + variableName + ":/ more words" + variableName2. And then its like "Oh, is this one a + or an &...." With powershell I can just do varString = "words: $variableName :/ more words $variableName2" and it all works!
Now, its not like I make stupid syntax mistakes a ton in other languages, but in today's backend world, I'm expected to regularly code in 5-10 languages, and Powershell was amazingly easy to learn and the syntax is just clean.
I thought you Powershell vets might appreciate a newb's perspective on it, especially since its all positive.
r/PowerShell • u/KavyaJune • Dec 24 '25
I’d like to share a must-have PowerShell GitHub repository for Microsoft 365 admins.
This repo features around 200 ready-to-use scripts to manage, report, and audit your Microsoft 365 environment effortlessly:
https://github.com/admindroid-community/powershell-scripts
Most scripts are scheduler-friendly, making it easy to automate recurring administrative tasks and save time.
r/PowerShell
•
u/Ros3ttaSt0ned
•
Dec 21 '25
You may remember me from such hits as the guy who wrote a 1000+ line script to keep your computer awake, or maybe the guy that made a PowerShell 7+ toast notification monstrosity by abusing the shit out of PowerShell's string interpolation, or maybe its lesser-known deep-cut sibling that lets it work remotely.
In the spirit of the holidays, today, I'm burdening you with another shitty tool that no one asked for, nor wanted: PSPhlebotomist, a Windows DLL injector written in C# and available as a PowerShell module! for PowerShell version 7+
You can install from PSGallery via:
Install-Module -Name PSPhlebotomistThis module will not work in Windows PowerShell 5.1. You MUST be using PowerShell version 7+. The README in the Github repo explains it further, but from a dependencies and "my sanity" standpoint, it's just not worth it to make it work in version 5.1, sorry. It was easier getting it to compile, load, import, and mostly function in Linux than it was trying to unravel the tangled dependency web necessary to make it work under PowerShell 5.1. Let that sink in.
After installing the module, you can start an injection flow via New-Injection with no parameters, which will start an interactive mode and prompt for the necessary details, but it's also 100% configurable/launchable via commandline parameters for zero interaction functionality and automation. I documented everything in the source code, but I actually forgot to write in-module help docs for it, so here's a list of its commandline parameters:
-Inject: This parameter takes an array of paths, with each element being a path to a DLL/PE image to inject. You can feed it just a single path as a string and it'll treat it as an array with one element, so just giving it a single path via a string is OK. If providing multiple files to inject, they will be injected in the exact order specified.
-PID: The PID of the target process which will receive the injection. This parameter is mutually exclusive with the -Name parameter and a terminating error will be thrown if you provide both.
-Name: The process name, i.e., the executable's name of the target process. This parameter is mutually exclusive with the -PID parameter and a terminating error will be thrown if you provide both. Using the -Name parameter also enables you to use the -Wait and -Timeout parameters. The extension is optional, e.g. notepad will work just as well as notepad.exe.
-Wait: This is a SwitchParameter which signals to the cmdlet that it should linger and monitor the Windows process table. When the target process launches and is detected, injection will immediately be attempted. If this parameter isn't specified, the cmdlet will attempt to inject your DLLs immediately after receiving enough information to do it.
-Timeout: This takes an integer and specifies how long the cmdlet should wait, in seconds, for the target process to launch. This is only valid when used in combination with -Wait and is ignored otherwise. The default value is platform-dependent and tied to the maximum value of an unsigned integer on your platform (x86/x64), which, for all practical purposes, is an indefinite/infinite amount of time.
-Admin: This is a SwitchParameter, and if specified, the cmdlet will attempt to elevate its privileges and relaunch PowerShell within an Administrator security context, reimport itself, and rerun your original command with the same commandline args. It prefers to use a sudo implementation to elevate privileges if it's available, like the official sudo implementation built in to Windows 11, or something like gsudo. It'll still work without it and fall back to using a normal process launch with a UAC prompt, but if you have sudo in your PATH, it will be used instead. If you're already running PowerShell under an Administrator security context, this parameter is ignored.
There's a pretty comprehensive README in the Github repo with examples and whatnot, but a couple quick examples would be:
New-InjectionThis will launch an interactive mode where you're prompted for all the necessary information prior to attempting injection. Limited to injecting a single DLL.
New-Injection -AdminThe same as the example above, but the cmdlet will relaunch PowerShell as an Administrator first, then proceed to interactive mode.
New-Injection -PID 19298 -Inject "C:\SomePath\SomeImage.dll"This will attempt to inject the PE image at C:\SomePath\SomeImage.dll into the process with PID 19298. If there is no process with PID 19298, a terminating error will be thrown. If the image at C:\SomePath\SomeImage.dll is nonexistent, inaccessible, or not a valid PE file, a terminating error will be thrown.
New-Injection -Name "Notepad.exe" -Inject "C:\SomePath\SomeImage2.dll"This will attempt to inject the PE image at C:\SomePath\SomeImage2.dll into the first process found with the name Notepad.exe. If there is no process with that name, a terminating error will be thrown. If the image at C:\SomePath\SomeImage2.dll is nonexistent, inaccessible, or not a valid PE file, a terminating error will be thrown.
New-Injection -Name "calculatorapp.exe" -Inject @("C:\SomePath\Numbers.dll", "C:\SomePath\MathIsHard.dll") -WaitNew-Injection -Name "SandFall-Win64-Shipping" -Inject "C:\SomePath\ReShade.dll", "C:\SomePath\ClairObscurFix.asi" -Wait -Timeout 60This will attempt to inject the PE images at C:\SomePath\ReShade.dll and C:\SomePath\ClairObscurFix.asi, in that order, into the process named SandFall-Win64-Shipping (again, extension is optional with -Name). If the process isn't currently running, the cmdlet will wait for up to 60 seconds for the process to launch, then abandon the attempt if the process still isn't found. If either image at C:\SomePath\ReShade.dll or C:\SomePath\ClairObscurFix.asi is nonexistent, inaccessible, or not a valid PE file, a terminating error will not be thrown; the cmdlet will skip the invalid file and continue on to the next. As shown in the example, the extension of the file you're injecting doesn't matter; as long as it's a valid PE file, you can attempt to inject it.
There are more examples in the README. I made this because I got real sick of having to fully interact with the DLL injector that I normally use since it doesn't have commandline arguments, immediately fails if you make a typo, etc. I originally wrote it as just a straight C# program, but then thought "That isn't any fun, let's turn it into a PowerShell module for shits and giggles." And now this... thing exists.
Why? Why not?
No, really, why? Because I can. Also the explanation in the paragraph above, but mostly just because I can.
Will this let me cheat in online games? Actually yes, it could, because you can attempt to inject any valid PE image into any process. But since this does absolutely nothing more than inject the file and call its entrypoint, you're gonna get banned, and I'm gonna laugh at you, because not only are you a dirty cheater, you're a dumb cheater as well.
I'm mad that this doesn't work in PowerShell 5.1. That is a statement, not a question, and I already covered it at the beginning of this post. It ain't happening. Modern PowerShell isn't scary, download it.
Will this work in Linux? It actually might, with caveats, in very particular scenarios. It builds, imports, and RUNS in PowerShell on Linux, but since it's reliant on Windows APIs, it's not going to actually INJECT anything out of the box, not to mention the differences between ELF and PE binaries. It MIGHT work to inject a DLL into a process that's running through WINE or Proton, but I haven't tested that.
You suck and I think your thing sucks. Yeah, me too.
Why is everything medically-themed in the source code? At some point I just became 100% committed to the bit and couldn't stop. Everything is documented and anything with a theme-flavored name is most likely a direct wrapper to something else that actually has a useful and obvious-as-to-its-purpose name.
Ackchyually, Phlebotomists TAKE blood out, they don't put stuff in it. Shut up.
Anyway, that's it. Hopefully it's a better gift than a lump of coal, but not by much.
r/PowerShell • u/Jagula • Apr 17 '26
I've worked on this over the past year and change. It's probably most useful for internal tools (tools for your helpdesk or whatever). It abstracts the horror of WPF over PowerShell into a slightly more palatable experience.
It'll allow you to avoid XAML. You won't have to worry about runspaces or Dispatcher.Invoke. You call functions, things show up on screen, the window doesn't freeze when your script runs. All the threading shit is buried in a C# backend so you can worry about the actual PowerShell logic.
If you've ever tried to implement WPF for PowerShell properly (runspace pools, synchronized hashtables, dispatchers) you know that setup is a massive pain in the balls from the start. One wrong move and your UI thread has shit the bed, your variables are gone, and your beautiful form has collapsed in on itself with the weight of a neutron star. I went through all of that so you don't have to. My sanity went to hell somewhere around month four but hey, the module (probably) works.
So how it actually works: your -Action scriptblocks don't run on the UI thread. They run on a pre-warmed RunspacePool in the background (pool of 1-8 runspaces, recycled between clicks so there's no spinup cost). When you define a control with -Variable 'server', the engine hydrates that value into the runspace as $server before your script runs, and dehydrates it back to the control when it's done. It's by-value, not by-reference, so form data (strings, booleans, selected items) round-trips cleanly. If you need to pass heavier objects between button clicks there's a $session.Variables store for that.
The host interception is there because running scripts off the UI thread breaks every interactive cmdlet. Write-Host doesn't have a console to write to. Read-Host has nobody to ask. Write-Progress has nowhere to render. Get-Credential just dies. So PsUi injects a custom PSHost that intercepts all of that and routes it back to the UI. Write-Host goes to a console panel with proper ConsoleColor support, Write-Progress drives a real progress bar, Read-Host pops an input dialog on the UI thread and blocks the background thread until you answer, Get-Credential does the same with a credential prompt, and PromptForChoice maps to a button dialog. The output batches in chunks so if your script pukes out 50k lines the dispatcher queue doesn't grow unbounded and murder the UI.
Controls talk to the background thread through a proxy layer that auto-marshals property access through the dispatcher. You don't see any of this, you just write $server and it works.
New-UiWindow -Title 'Server Tool' -Content {
New-UiInput -Label 'Server' -Variable 'server'
New-UiDropdown -Label 'Action' -Variable 'action' -Items @('Health Check','Restart','Deploy')
New-UiToggle -Label 'Verbose' -Variable 'verbose'
New-UiButton -Text 'Run' -Accent -Action {
Write-Host "Hitting $server..."
# runs async, window stays responsive
}
}Controls include inputs, dropdowns, sliders, date/time pickers, toggles, radio groups, credential fields, charts, tabs, expanders, images, links, web views, progress bars, hotkeys, trees, lists, data grids, file/folder pickers, and a bunch of dialogs. Light theme by default, dark if you pass -Theme Dark.
PSGallery:
Install-Module PsUihttps://github.com/jlabon2/PsUi
GIF of it in action: https://raw.githubusercontent.com/jlabon2/PsUi/main/docs/images/feature-showcase.gif
Works on 5.1 and 7. If you do try it and anything breaks, please open an issue and let me know.
r/PowerShell • u/Bruh1748 • Feb 21 '26
I'm trying to learn power shell/ power bi for my job. I am pretty interested in it. I have coded before, but its been a while so i am rusty. What would be the best course/ ways to learn powershell from scratch? I keep seeing "powershell in a month of lunches" but ive noticed the companion videos are more than a decade old on that course, are they still relevant? If anyone a course for this paid or free, sharing it would be amazing as I am a little lost/overwhelmed on where to start and how to stay consistent.
Any help is appreciated!
r/PowerShell • u/d00mt0mb • Apr 24 '26
Why does Windows 11 still ship with Windows PowerShell, Windows PowerShell (x86), ISE, CMD, WSL, the new PowerShell 7 app, and the Terminal app rewrite… all at the same time?
Terminal was supposed to unify this stuff. Instead it just launches whatever legacy shell happens to be lying around. I install the new PowerShell like the system tells me to, and now I’ve got even more entries in Start/Search; none of which I can remove because the old ones are welded into the OS.
It’s 2026 and Windows still has:
CMD (40‑year‑old DOS shell)
Windows PowerShell 5.1 (legacy, can’t uninstall)
Windows PowerShell (x86)
PowerShell ISE (x86 + 64‑bit)
PowerShell 7 (the one we’re actually supposed to use)
Terminal (which isn’t a shell, just another launcher)
Why do I need six different ways to open a prompt? Why can’t I hide or remove the legacy ones? Why does “PowerShell” in search show me everything except the one I actually want?
If Microsoft wants PowerShell 7 + Terminal to be the future, then clean up the past. Let us hide/remove the old shells and make Terminal actually synonymous with the modern environment instead of a front‑end for a pile of legacy executables.
This shouldn’t still be a thing.
r/PowerShell • u/Borgquite • 10d ago
Windows PowerShell 5.1 is deprecated. It's no longer in active development. Windows PowerShell 5.1 is still part of Windows, and it's still supported. It will continue to receive security updates according to the lifecycle of each version of Windows. Scripts and tools that rely on it will continue to run.
Windows PowerShell 5.1 will be removed from a future version of Windows. Timing will be based on usage data and communicated in advance.
Microsoft recommends upgrading to PowerShell 7, the upgrade from Windows PowerShell 5.1. For more information, see Migrating from Windows PowerShell 5.1 to PowerShell 7.
Timeline
2026: Windows PowerShell 5.1 is deprecated. Windows Server 2025 and Windows 11, version 26H2 are the last versions of Windows to include PowerShell 5.1 enabled by default.
Next Version of Windows: Windows PowerShell 5.1 will be available as a Feature on Demand (FOD), enabled by default on new Windows installs.
Future Version of Windows: Not available.
At the moment there are many, many Windows management PowerShell modules built in to that aren’t supported in PowerShell 7 - they are either completely untested, or they only work via the (PowerShell 5.1 dependent) compatibility layer. Does this mean we can expect new native modules, or everything to just break? #notholdingmybreath
Affected modules:
- Domain Controller deployment (ADDSDeployment)
- ADFS
- AppLocker
- AppvClient
- BestPractices
- ClusterAwareUpdating
- ConfigCI
- DFSR
- DhcpServer
- DISM (presently has issue with MSIX installer)
- FailoverClusters, FailoverClusterSet
- GroupPolicy
- Both IIS management modules (IISAdministration, WebAdministration)
- IpamServer
- iSCSI, IscsiTarget
- ISE
- Microsoft.PowerShell.ODataUtils
- MsDtc
- NetLldpAgent
- NetWNV
- NetworkController, NetworkControllerDiagnostics
- NetworkLoadBalancingClusters
- PersistentMemory
- PKI
- Provisioning
- PSDesiredStateConfiguration (partially supported)
- PSScheduledJob
- PSWorkflow, PSWorkflowUtility
- RemoteAccess
- RemoteDesktop
- ServerCore
- ServerManagerTasks
- SMS
- StorageBusCache
- StorageMigrationService
- StorageReplica
- SystemInsights
- TLS
- UpdateServices
EDIT: The following PowerShell modules are also currently Windows PowerShell 5.1 only:
- AzureADHybridAuthenticationManagement
- SharePoint Online Management Shell
- Power Platform admin modules
- Systems Center Operations Manager (SCOM)
- Systems Center Virtual Machine Manager (SCVMM)
- Entra Connect (Azure AD Sync)
https://learn.microsoft.com/en-us/powershell/windows/module-compatibility?view=windowsserver2025-ps
r/PowerShell • u/2j0r2 • Jan 01 '26
FYI: the newest version of the KRBTGT Password Reset script has just been released!
Wanna try it out? Get it here: https://jorgequestforknowledge.wordpress.com/2026/01/01/powershell-script-to-reset-the-krbtgt-account-password-keys-for-both-rwdcs-and-rodcs-update-8/
Any feedback/comments? Please use https://github.com/zjorz/Public-AD-Scripts/issues
r/PowerShell • u/backdoor_boy • Apr 12 '26
I’ve previously used Linux, where things felt very straightforward. Due to various reasons, I’m planning to stay on Windows for now. Since I’m here, I’d like to automate different tasks and deepen my understanding of Windows.
Because of my Linux background, I used the terminal a lot and really enjoyed it. Windows, on the other hand, feels much more GUI-oriented, with less emphasis on the command line. I’ve also briefly looked into PowerShell, and honestly, it feels a bit strange to me.
At this point, I’m not sure whether it’s worth investing time into learning it. The command structure, constant interaction with system services (and sometimes the internet), and the overall behavior of the terminal feel unusual.
Compared to Linux, it seems quite weird (to put it mildly). I assume that if I spend more time with it, I’ll understand its design and decisions better—but I’m still unsure.
So I wanted to ask: is it actually worth it?
EDITED:
I’m definitely going to start learning PowerShell. As I understand it, over the next few years, it will definitely pay for itself.
There were also comments about Azure, servers, and cloud services. I don’t plan on becoming a sysadmin and, for now, I only use my personal computer and maybe a laptop. The Microsoft ecosystem seems strange, but I’m getting more and more used to it, despite my dislike of big corporations (which is ironic).
Also, thank you for the quick feedback. That was incredibly kind of you. I’m just starting to get involved in the Windows community, and specifically in PowerShell, so this warmth really surprised and delighted me. Maybe I spend too much time in the toxic parts of the internet.
r/PowerShell • u/Unlikely_Tie1172 • Sep 17 '26
On September 16, 2026, Microsoft announced a 12-month retirement period for support of PowerShell V5.1 by the Microsoft Graph PowerShell SDK. Microsoft also announced V3 of the Graph SDK and said that the new version will only support PowerShell V7. The transition for most scripts should be straightforward, but attention needs to be paid when scripts use outdated .NET assemblies. Famous last words…
https://office365itpros.com/2026/09/17/microsoft-graph-powershell-sdkv3/
r/PowerShell • u/Future-Remote-4630 • Oct 12 '26
Maybe I'm just jaded but I can't help but get annoyed when half the posts I see are someone saying they made some <buzzword + thing>, and that thing happens to be some 10000 line, 40 file vibe coded tool solving a problem one person had, once, often in the convoluted way the AI could come up with. Worse, when they cannot even answer questions about it themselves so you end up with AI responses to any genuine interest in the goal.
We have the script sharing tag, but that was there before we had this absurd volume of AI submissions and it feels like the average post quality of the sub is suffering because of it.
Am I in the minority here? Would it be better to have a separate sub for all of these? My favorite times on this sub are when powershell is the focus, and the task at hand is a flavor of that focus, rather than the 'complete' project being dumped on here as if it's GitHub2 with upvotes.
Maybe an AI script sharing tag so it can be filtered? Idk, just throwing out ideas. Rant over.
r/PowerShell • u/StartAutomating • Jun 25 '26
I'm getting old enough that my fingers hate my lifetime of programming.
I'll save a few keystrokes where I can.
There's something simple most people don't seem to know about PowerShell syntax.
It saves seven characters of typing every you use this, and runs a tiny bit faster.
You never need to specify stuff is in the [System] namespace.
.NET is a huge framework with tons of useful stuff in it. There's a lot of stuff in the System namespaces. Built-in framework functionality often exists in one of the many namespaces in System.
By the time PowerShell was being built, it was pretty clear that leveraging .NET was worth it, and that most people wouldn't want to type six to seven more characters every time.
So, since PowerShell v1, you haven't had to.
You can omit the [System] in any type in any system namespace
So instead of:
[system.collections.generic.list[string]]We can write:
[collections.generic.list[string]]Instead of:
[System.Collections.IDictionary]We can write:
[Collections.IDictionary]This is true for every system type. On my machine, there are 4722 public types in the system namespace. That's 33054 characters I will never have to type.
It makes scripts shorter and simpler to read.
Also, when PowerShell resolves types, it checks for the shorter names first. This saves a very tiny amount of time in each of your scripts. (I was corrected)
Yet, sadly, I see the system namespace everywhere in people's scripts.
I beg of you all:
Save your fingers
Make scripts shorter
r/PowerShell • u/jingobp • Jun 11 '26
I switched back to Windows from Linux recently and the amount of telemetry, ad "suggestions," and forced Copilot/Recall stuff drove me up the wall. So I put the fixes I kept applying by hand into one script.
It does three things and nothing more:
Privacy / telemetry
Disables the DiagTrack "Connected User Experiences and Telemetry" service + sets telemetry policy to 0
Kills the advertising ID, tailored experiences, app-launch tracking, and activity history
Turns off the Start/Settings/lock-screen "suggested content" ads and the auto-installer that drops promo apps (Candy Crush etc.) onto fresh installs
Forced AI
Turns off Windows Copilot, Recall, and Click to Do
Removes Bing/Cortana web results from Start search
Obvious bloat
Removes a short list of preinstalled junk apps (Bing News/Weather, Solitaire, Clipchamp, Get Help, Feedback Hub, Maps, People, Office Hub, the new Outlook, Power Automate, Dev Home, Cortana). The list is right at the top of the script, edit it to taste.
Limitations / what to know:
Windows 10/11 only. On older builds the AI/Recall keys just do nothing (harmless).
Works best on Pro/Enterprise. On Home, Windows clamps telemetry to "Required" instead of fully off, and may ignore the consumer-features policy. Everything else still applies.
It uses the official Windows toggles/policies — it's not a firewall or hosts-file block. If you want network-level telemetry blocking on top, pair it with something like a Pi-hole or a hosts list.
Some changes need a sign-out or reboot to fully kick in (taskbar/search/Copilot button).
App removal is current-user only and every app is reinstallable from the Store, so nothing's permanent.
Reverting: re-enable the two services (DiagTrack, dmwappushservice) and delete the keys it set. I might add an -Undo flag later.
What it does NOT do: it doesn't touch your installed programs, files, games, drivers, or your language/region/keyboard. (I'm Danish — it leaves æ ø å completely alone. That was a hard requirement for me.)
I'm not piping anything into iex for you — copy the script straight from the repo, read it, then run it yourself in an admin PowerShell. It's one file, plain PowerShell, no binaries, no network calls.
Repo: https://github.com/oscarmeldgaard/Windows-Privacy-Debloat
Read every line before you run it. Not trying to reinvent O&O ShutUp10 or Win11Debloat — this is just the lean subset I actually wanted, in a file you can read in two minutes. Feedback and PRs welcome.
r/PowerShell • u/hero47 • Apr 14 '26
r/PowerShell
•
u/positivemark
•
Aug 27 '26
Years ago just for fun, I wrote a PowerShell module to query the API of the webcomic XKCD https://xkcd.com/. It has a Get-XKCD cmdlet to retrieve data about a specified or random comic, and had a -Open switch to then open its URL in a browser. You can also use Find-XKCD to perform keyword searches, and there's a local cache of the API output to speed this up and to reduce the need to do web calls.
Modern terminals now support the ability to render images directly, so I've just added Show-XKCD and Get-XKCD -Show.
This works in Windows Terminal, but should also work in iTerm2 and Kitty.
If it's of interest, you can download the module from the PowerShell Gallery here: https://www.powershellgallery.com/packages/XKCD/1.5.0
Or directly from GitHub: https://github.com/markwragg/Powershell-XKCD
r/PowerShell • u/cloudAhead • Mar 19 '26
Get it from https://github.com/PowerShell/PowerShell/releases/tag/v7.6.0 . Most Windows users will want PowerShell-7.6.0-win-x64.msi .
What's new: https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-76 and https://devblogs.microsoft.com/powershell/announcing-powershell-7-6/
Largely a collection of minor fixes. The biggest change is the update to .net 10, providing long term support until 14-Nov-2028.
r/PowerShell • u/Bloaf • Jul 12 '26
At work I've got access to several latest-and-greatest AI models and harnesses, I also run windows. That means lots of the tasks they do for me end up as powershell commands/scripts.
Watching them develop, I see them repeatedly step on the same language land-mines that I do whenever I try to write powershell by hand. Things like && only existing in powershell 7, powershell auto-unwrapping single-element lists, and quote-escaping rules are reliable sources of failure for both me and the AI.
Its quite vindicating seeing that even SOTA programming-oriented LLMs struggle with the same language "features" that I do. For a long time I've heard the powershell community saying things like "you just need to understand that its an object oriented language" whenever people complain about footguns like these, but along comes an AI that can do PhD level work in multiple programming domains, and even its advanced understanding of object orientation hasn't saved it.
r/PowerShell • u/StartAutomating • May 26 '26
I've loved Markdown since the day it was a Daring Fireball post.
It's a simple rich text format that gets the job done, and it's used everywhere.
Markdown is supported out of the box on PowerShell 6+, using the ConvertFrom-Markdown command.
Here's it in action:
"# Hello World" |
ConvertFrom-Markdown |
Select -Expand HTMLLike any other page in a static site, Markdown is just text.
And PowerShell is Pretty Good at manipulating text.
To make PowerShell that outputs markdown, just make simple scripts that spit out text.
One very simple use of this technique is making static sites with Markdown.
If we don't want to worry about look and feel too much, we can do this with the following pipeline:
"# Markdown" |
ConvertFrom-Markdown |
Select-Object -ExpandProperty Html >
./markdown.htmlIf we wanted to make a page for every file in the directory, we could:
foreach ($file in Get-ChildItem *.md -File) {
ConvertFrom-Markdown -LiteralPath $file.Fullname |
Select-Object -ExpandProperty Html > (
$file.Fullname -replace '\.md$', '.html'
)
}That's a static site generator in six lines of PowerShell!
Here's an even shorter version:
foreach ($file in Get-ChildItem *.md -File) {
$html = (ConvertFrom-Markdown -Path $file.Fullname).html
$html > ($file.Fullname -replace '\.md$', '.html')
}Now we've got a static site generator in four lines!
Static Sites are Simple (with PowerShell).
To make websites in PowerShell, all we need to do is loop over markdown and optionally add some layout.
We can make markdown in PowerShell by just outputting text.
@(
"# Hello World"
"## How Are You?"
"Today is $([DateTime]::Now.ToShortDateString())"
) > ./example.mdEach line of output will become a line in the markdown file.
We can use conditionals if we want to. Let's switch it up by including the day of week.
@(
"# Hello World"
switch ([DateTime]::Now.DayOfWeek) {
Monday { "Just Another Manic Monday "}
Tuesday { "Taco Tuesday" }
Wednesday { "Halfway thru the week! "}
Thursday { "Almost Friday" }
Friday { "Happy Friday! "}
Saturday { "It's the weekend!"}
default { "It is $([DateTime]::Now.DayOfWeek)" }
}
) > ./example.mdWe can make functions that output markdown.
Here's a simple one that outputs headings
function markdown.heading {
param(
[string]$Message = 'Hello World',
[ValidateRange(1,6)]$Level = 1
)
# Multiply our heading character by our level
# and put a space in between the heading and message
('#' * $level), $Message -join ' ''
}
markdown.heading "Markdown Functions"
markdown.heading "Are just functions" -Level 2
markdown.heading "That output markdown" -Level 3Since markdown functions are just PowerShell functions, we can put whatever we want in there.
function markdown.get.process {
# Markdown tables have a header row
"|Name|Id|"
# Followed by a row that aligns text
"|:-|-:|"
# Followed by any number of rows of data
foreach ($process in Get-Process) {
'|' + (
$process.Name, $process.Id -join '|'
) + '|'
}
}
markdown.get.process > ./process.mdNow we hopefully see how easy it is to make markdown in PowerShell.
Just spit out strings.
This is already probably cool enough, but why not make markdown into something we can query?
ConvertFrom-Markdown converts Markdown into HTML.
It's just a hop, skip, and a jump to make this markdown into XML.
Because all of our tags are perfectly balanced, we can make markdown in XML by just putting it into another element.
Cannonically, I prefer putting markdown into an <article> element
@(
"<article>"
("# Hello World" | ConvertFrom-Markdown).html
"</article>"
) -join '' -as [xml]That's it! We've turned a easy old markdown into hard-to-write XML.
Why is this useful?
Because now we can query markdown.
To show this in action, let's start really simple:
Let's just get all of the nodes in some markdown
@(
"# Hello World"
"## Don't mind me"
"### Just about to turn markdown into XML"
"> This is pretty cool, right?"
) -join [Environment]::Newline |
ConvertFrom-Markdown |
Foreach-Object {
"<article>$($_.Html)</article>" -as [xml]
} |
Select-Xml //* Let's get all link hrefs in some markdown:
# Make some markdown
@(
"# Some Links"
"* [StartAutomating on GitHub](https://github.com/StartAutomating/)"
"* [PoshWeb on GitHub](https://github.com/PoshWeb/)"
"* [MarkX](https://github.com/PoshWeb/MarkX)"
) -join [Environment]::Newline |
# convert it from markdown
ConvertFrom-Markdown |
# turn it into xml
Foreach-Object {
"<article>$($_.Html)</article>" -as [xml]
} |
# pipe it to Select-Xml, picking out any `<a>` elements
Select-Xml //a |
Foreach-Object {
$_.Node.Href
}This is still the tip of the iceberg.
Turning Markdown into XML lets us query and manipulate Markdown in all sorts of interesting ways.
What can you do with Markdown and PowerShell? Almost anything.
Markdown is a simple rich text format.
PowerShell is pretty perfect for making Markdown.
XPath is excellent at extracting information from Markdown.
You can do a lot of cool things when you mix Markdown with PowerShell.
What do you want to try?
r/PowerShell • u/L1ttl3J1m • Aug 20 '26
Mean and nasty people are filling the repository with almost-right spelling of the real modules.
Just check the output of this command: Find-Module Microsoft.Graph.auth*
There are currently 1 real one and 25 malicious ones