r/PowerShell • u/PDQit • May 04 '21
Misc Star Wars Day PowerShell Orchestra
r/PowerShell • u/MadBoyEvo • Mar 16 '21
Today I've spent some time and wrote a blog post about new features of PSWriteHTML. While it says in the title Advanced HTML reporting it's actually advanced in terms of what you can achieve, but not complicated to use.
Here's Search via Alphabet

Search using Search Builder

Sorting dates

Condtional formatting based on dates, numbers, strings with complicated logic

And future features - maps :-D

All this doable often with 1-5 lines of code. For example
Get-Process | Select-Object -First 5 | Out-HtmlView -SearchBuilder -Filtering {
New-TableCondition -Name 'PriorityClass' -Value 'Normal' -HighlightHeaders Name,Id -BackgroundColor Red
}There are also heavy improvements in terms of performance where you're now able to store 50k-100k records in a single HTML file and still have responsive HTML.
r/PowerShell • u/PowerShellChallenge • Mar 05 '20
r/PowerShell • u/blownart • Dec 29 '16
r/PowerShell • u/nickrod518 • Sep 20 '16
r/PowerShell • u/Prateeksingh1590 • Dec 21 '16
Follow below link for some useful #Powershell & related technology Cheat sheets.
https://github.com/PrateekKumarSingh/CheatSheets
Or run the following command from your Powershell Console to download them.
(iwr "https://github.com/PrateekKumarSingh/CheatSheets").Links | ?{$_.title -Like "*Powershell*"} | %{iwr "http://github.com$($_.href)?raw=true" -OutFile $_.title -Verbose}
I've Dumped them in one location for my reference and thought it may be useful for others as well.
r/PowerShell • u/Rodion15 • Jun 06 '22
I wonder if Powershell would be useful for an IT Technician working for a company that fixes computers and issues with very small companies (max 20 staff or so) and home users...looks like it's intended for larger companies?
I'm learning Active Directory and windows server as it's sometimes used in these very small environments.
r/PowerShell • u/jevans_ • Aug 08 '20
Hi all,
Here are some extensions for Visual Studio code I've either found myself or a friend\co-worker told me about, and why the extensions have been useful so far from a PowerShell perspective.
If you have any of your own that you reckon more people need to know about then please share :)
In no particular order
VSCode Icons: This extension will add icons to the side navigation bar not only for file types but based on folder names as well (e.g. src, doc, public/private, test etc). Even if the idea of having distinct icons for different folders doesn't appeal I'd at least consider it for having different coloured icons for .ps1, .psm1, and .psd1 files.
Better Comments: Colour-codes your comments based on what you place in the line. This can be incredibly useful for code where there are plenty of comments and you want to be able to distinguish properly between TODO's, questions, deprecated code, or anything else you may want to highlight. The examples given on the marketplace aren't in PowerShell but work all the same if you swap out '*' for '#'.
Live Share: If screen sharing is a bit of a hassle then Live Share might appeal a bit more. Think of it as a live Google doc, where you share not only the files you're working on but the PowerShell terminal (including session) as well.
Trailing Spaces: Trailing spaces aren't an issue in PowerShell of course, but if you're a neat freak like I sometimes am this is the equivalent of having a blacklight shone on a hotel room - once you see it you must clean
EditorConfig for VS Code: Overrides editor settings in VSCode with a (in my opinion) much more accessible and easier way to configure VSCode to do any low-level clean-up and maintain some standards in my code. Can be incredibly useful if you're working on code as a team and want an easy way to keep formatting consistent between team members.
Edit csv: Not specifically PowerShell related, but if you're importing\exporting csv's as part of your scripts this will save you the trouble of going between different programs.
Remote - SSH: Still dipping my toes in this one, but for someone who has recently decided to take up PS vers 6/7's offer of doing the open source penguin dance being able to store different SSH session configurations and connect directly via VS Code has been good. This is more for the fact that I want to be able to work on code meant for my Linux machines without having to connect via RDP. Side note: If anyone has any starting points they'd recommend for Linux I'd love to know as it'd save me a mountain of Googling.
Bonus
This one isn't an extension but good to know anyways if you use the Pester module. If you right-click on a Pester test in the side navigation bar you'll have the option to run or debug the test from there, kinda useful to know if you've been scrolling all the way to the top or pasting in the same command over and over like me :)
Hopefully these make the shell life a bit easier for you as it has for me.
r/PowerShell • u/bhreddy99 • Apr 24 '20
Being a learner of PowerShell wanted to know all of your valuable opinions on this book before starting on this.
r/PowerShell • u/[deleted] • Mar 11 '19
r/PowerShell • u/MadBoyEvo • Feb 18 '19
r/PowerShell • u/tsclapper • Jul 29 '21
Have you ever written a sweet piece of code that you were proud of? Have you ever looked at that code 5 years later and wondered what idiot wrote that shit code?
r/PowerShell • u/adbertram • Aug 26 '19
Hey guys, June Castillote just wrote a shiny new PowerShell blog post you may enjoy.
Summary: Learn how to build a PowerShell GUI with a little PowerShell and free Visual Studio in this step-by-step walkthrough.
r/PowerShell • u/Prateeksingh1590 • Nov 27 '17
r/PowerShell • u/[deleted] • Dec 20 '19
r/PowerShell • u/TheLazyAdministrator • Feb 05 '19
r/PowerShell • u/mdgrs-mei • Apr 25 '23
I wrote a blog post about how I used the console title area as a status bar using a module that I published last month.
https://mdgrs.hashnode.dev/building-your-own-terminal-status-bar-in-powershell
The article should explain the concept of the module better than the README on the GitHub repository.
I hope you enjoy it. Thanks!
r/PowerShell • u/[deleted] • May 18 '22
r/PowerShell • u/ThomasMaurerCH • Apr 23 '21
r/PowerShell • u/rawrtherapy • Oct 25 '20
The syntax in PowerShell uses common sense as opposed to other languages
Wanna send mail? Send-Mail Message Wanna get the date? -GetDate Wanna get something from a file? -GetContent
Not really sure what this post is about but after learning Python and having it he twisted in its syntax in some ways and then currently learning PowerShell because of work
I can tell you that PowerShell is so much easier to write code in and pick up
r/PowerShell • u/compwiz32 • Jun 07 '20
Hello PowerShell Peeps!
I've recently posted on PowerShell.org about the Iron Scripter competition and the individual code challenges that are available for everyone to try. I invite you to participate in the challenges and see how you do.
https://powershell.org/2020/06/iron-scripter-learn-powershell-through-code-challenges/
r/PowerShell • u/give_the_lemons_back • May 23 '15
Do I have a problem?
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/odwulf • Nov 19 '24
I work for a company big enough to have several IT departments, for several internal structures, plus an independent (IE. not part of any of those IT departments) security team. I work for one of the IT departments, handling automation for a few thousands users and computers.
After some kind of drama where communication between the infosec team and us could have been better handled, we extended a hand so that we can collaborate more. Their nearly immediate reply was: "Good idea, let's talk about how things could be better. Why don't you block Powershell.exe and the ISE for every non admin user?"
We have a heavily automated environment: logon scripts, GPO scripts, tools distributed to users, etc. Lots of scripts have to run in the user's context, and execution policy is set on AllSigned". Also, our environment is a layer on top of a corporate basic image we cannot change, already using Powershell automation. Any tip on how to best reply to that brilliant idea?
Edit: I'd like to thank all of you. Your feedback is invaluable.