r/PowerShell • • May 18 '21

Information Network Troubleshooting w/ PowerShell

Thumbnail
youtu.be
141 Upvotes

r/PowerShell • • Nov 19 '20

PowerShell Splatting: What is it and How Does it Work?

141 Upvotes

Hey guys,

Adam Listek just wrote a shiny new blog post you may enjoy.

"PowerShell Splatting: What is it and How Does it Work?"

Summary: PowerShell splatting is the strange phrase that can turn your script from a mess of code to a nicely structured work of art. Learn how in this tutorial!

https://adamtheautomator.com/powershell-splatting-what-is-it-and-how-does-it-work/


r/PowerShell • • Apr 22 '20

News Windows Terminal Preview v0.11 Release | Windows Command Line

Thumbnail
devblogs.microsoft.com
141 Upvotes

r/PowerShell • • Jan 18 '19

I made a thing (Powershell Universal Dashboard)

141 Upvotes

Hi all,

Sometimes getting the idea is half the work. So I’m posting this for inspiration, and, frankly, to toot my own horn!

https://forums.universaldashboard.io/t/dashboard-displaying-information-on-consultants-and-employees/281

Monthly, at least, HR had to go through the process of gathering information on consultants, by going to Supply Chain Management and have them scrape data off contracts. That’s all lot of of the same work again and again.

So they realized that a lot of that information where already present “digitally” in our AD: contract expirations were reflected in account expiration, place of work, department and who they report to as well.

With some simple scripts to gather and treat the data from AD, and the magic that is Universal Dashboard. I was able to make a dashboard that show consultants distribution in the company, both organizational and geographical. The planned decline in consultants and of course what assets they are registered owner of (assets details are stored in a database I coincidentally made for fun recently).

Most of the stuff I do with powershell goes unnoticed, but this is the first time I’ve ever had management look at something I made. Pretty great feeling!

Enjoy your weekend!


r/PowerShell • • Jun 23 '18

Create an Interactive HTML Report for Office 365 with PowerShell

Thumbnail
thelazyadministrator.com
141 Upvotes

r/PowerShell • • Nov 22 '19

News AWS Tools for PowerShell is now generally available with version 4.0

Thumbnail
aws.amazon.com
140 Upvotes

r/PowerShell • • Jul 26 '24

Script Sharing Leveling up PowerShell Profile

139 Upvotes

Hello PowerShell Enthusiasts 👋,

Many people treat their shell as just a script runner, but as someone who loves PowerShell and runs it on all their machines (Windows, Mac, and Linux), I wanted to share all the amazing things you can do with it beyond just running scripts.

https://blog.belibug.com/post/ps-profile-01/

My latest blog post has several not-so-common ways to elevate your PowerShell experience for beginners. It covers:

  • Personalizing your prompt

  • Mastering aliases and modules

  • Leveraging tab completion

  • Enhancing your shell with modules

  • ...and much more!

This list is just the tip of the iceberg! If you have any other PowerShell tricks or tips that I haven't covered, or there is better way to do it, let me know – I'm always eager to learn and will update content accordingly 😊 Happy weekend!

PS: Don't let the length scare you off! Use the handy TOC in the blog to jump around to the juicy bits that interest you most. Happy reading! 🤓


r/PowerShell • • Mar 14 '22

Script Sharing Introducing Azure Administrator - A new (mostly) open-source GUI for all your Azure help desk needs!

139 Upvotes

First and foremost, a heartfelt and sincere thank you! to all the folks that have helped out in this community along my journey.

Before I throw a bunch of info at you guys/gals, I'd like to preface with this: No, that is not a clickbait title. I say mostly open source because I have provided all my source code here, but I created the whole project using Sapien's PowerShell Studio; so you can see what's there, but you'll need to find yourself a copy of PowerShell Studio to edit it. No worries though, I have a generic MSI you can use!

I've been working on this project for quite a while trying to get things just right. I almost had it complete, until Microsoft announced they were deprecating the AzureAD PS module. So I did what any good sysadmin would do... Sat down and taught myself APIs!

And this application is the end result of my learning/training! I leverage PowerShell and the Microsoft Graph API to get it done. This app does all your most basic help desk tech needs, primarily user and group management (with more to come at a later date!), including: New User, Edit User, Terminate User, Add User to Group, Assign License, and more.

All of this is free to the world, free to everybody - I believe in the power of sharing knowledge. :) All I ask is for any feedback/bugs you guys might find along the way. As of right now, there's only one known major bug: When assigning licenses, if you try to do multiple there's a possibility it will fail, due to weird rate limiting by Graph. Currently investigating.

The only pre-requisite to deployment is that you'll need to create a registered application in AAD and enter in the AppID/ClientID on first program run when prompted. You can find all the steps on how to do that here, courtesy of Microsoft.

Edit to add: I totally forgot! Every single function I used in this application is available here as well, complete with (some) documentation!

ETA2: Guys, I can't directly link screenshots here because my post keeps getting auto-removed. Please see one of my other posts for links to the screenshots.


r/PowerShell • • May 14 '19

Information Paul on the PowerShell Team just published a new RFC to enable `foreach -parallel` in PowerShell 7 (outside of workflows)

Thumbnail
twitter.com
139 Upvotes

r/PowerShell • • Dec 29 '17

Just sharing some of my PowerShell scripts that you guys may find useful.

139 Upvotes

Linky-poo: https://github.com/AndrewEllis93/PowerShell-Scripts

  • ADHealthCheck: This one is largely based on a script by Vikas Sukhija, who is credited in the body. I really only made some minor edits to his. Mine just adds a column that shows the last replication time and only emails if there is an unhealthy status or failure to cut down on email spam.

  • Disable-InactiveADAccounts: Make sure you read through the comments (as with all of these scripts). It just finds the last logon for all AD accounts and disables any that have been inactive for X number of days (depending on what threshold you set). The difference with this script is that it gets the most accurate last logon available by comparing the results from all domain controllers. By default the lastlogontimestamp is only replicated every 14 days minus a random percentage of 5. This makes it much more accurate, but also it is a very slow script for reasons I can't quite figure out. But it works. It also supports an exclusion AD group that you can put things like service accounts in to prevent them from being disabled. It will also email a report to the specified email addresses.

  • Discover-DriveSpace: This one gets all your servers in AD and dumps the drives with sizes and remaining free space to a CSV (drivespace.csv). It also export some other files - pingable.txt, pingfail.txt, and servers.csv. Those should be self-explanatory.

  • Discover-Shares: This one is a discovery function to find all Windows shares on the domain. Useful for acquisitions.

  • Dump-GPOs: This one exports all of your GPOs' HTML reports, a CSV detailing all the GPO links, and a txt list of all the GPOs.

  • Enumerate-Access: This function will spit back all of the permissions of a specified folder, recursively. You can choose to return inherited permissions or not. I wrote this specifically to show each and every ACL entry on a separate line. It's really useful for finding where a group or user is being used in NTFS ACLs. This helped us get rid of mail-enabled security groups by discovering each place that they were being used in NTFS ACLs so we could replace them. In most cases you won't want it to return inherited permissions (it doesn't by default) so you don't get a TON of redundant output, just the explicit ACL entries. It will generate a lot of disk activity on the target server because it scans the entire file system of the folder specified. At one point I actually combined this with the Find-Shares script to enumerate the ACLs on every file share we had. It took forever, needless to say, but helped a lot with weeding out old AD groups :)

  • Move Disabled: This moves disabled computers too. It rounds up disabled accounts and ages them through different OUs (0-30 days, 30-180 days, over 180 days).

  • Move-StaleUserFolders: This script will scan all first-level sub-folders of the specified BasePath to find the most recent LastWriteTime in each one (recursively). This is really intended for user folders. It will move stale folders to the directory specified. You can modify this to just report instead, read the description up top.

  • Restart-DFSRAndEnableAutoRecovery: Nice and short and simple. It restarts the DFSR service on all domain controllers (I schedule this to run nightly. This isn't really necessary but I have found it to prevent some misc issues that crop up once in a blue moon) and enables DFSR auto-recovery, which for whatever reason is disabled on domain controllers by default.

  • Send-PasswordNotices: This sends password expiration notice emails to users at 1,2,3,7, and 14 days. Supports an AD exclusion group.

As with all scripts you find on the internet, please carefully read through them and understand what they do before blindly running them in your environment. Always run in a test environment first. I put a fair bit of comments in these to try and make them easier to understand. Some have warnings at the top so please read those. Some also have "-ReportOnly" arguments that you can add to only get the output of the actions it would take.


r/PowerShell • • Aug 19 '16

Curl author asks Microsoft to remove 'curl' and 'wget' aliases from PowerShell

Thumbnail
github.com
139 Upvotes

r/PowerShell • • Jun 11 '26

Script Sharing Made a PowerShell script that strips telemetry, ads, and forced AI out of Windows 11 (and nothing else)

138 Upvotes

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 • • Mar 27 '23

Script Sharing I just released PSSnow - A module for interacting with ServiceNow REST APIs

138 Upvotes

In the past 3 weeks I've put together a PowerShell module for interacting with the ServiceNow REST API in an intuitive user friendly way.

Hopefully this comes in handy for people and allows you to write cleaner code whilst interacting with ServiceNow!

Check out my demo video here (20mins - it covers alot of features!) : https://youtu.be/UfT_pz82bn8

Powershell Gallery: https://www.powershellgallery.com/packages/PSSnow

Some of the key features:

  • Handles OAuth auto token renewal

  • Pagination is handled automatically (but can still be manually controlled)

  • Provides generic 'template' functions to interact with all tables

  • Provides table specific functions with auto-complete

  • Batch API integration is as easy as wrapping your existing code with a scriptblock

  • Attachments can be passed through without the need to interact with the filesystem

  • Service Catalog requests and incidents can be automated

  • Filters/Queries can be copied directly from ServiceNow and used in table GET commands

  • Dot walking across tables is possible

  • Get the variables for a specified RITM (values for all fields logged in a catalog form)

Github Project: https://github.com/insomniacc/PSSnow

Function Builder Demo: https://youtu.be/-KzV9Ao9Hsc


r/PowerShell • • Apr 23 '22

What new acquired PowerShell concept/understanding significantly improved the quality/performance of your scripts that inspired you to go back and integrate it into some of your old scripts?

138 Upvotes

r/PowerShell • • Dec 18 '21

Here is a Simple Script to detect for potential Log4J Vulnerabilities. I was scanning hashes earlier in the week but that proved unreliable so this just looks for known versions and unpacks to check for the class. Its been quick and reliable so far, just sharing as another option - good luck all!

Thumbnail
github.com
138 Upvotes

r/PowerShell • • Feb 28 '21

How to create a loaner laptop checkout/checkout system in Powershell

Thumbnail
smarthomepursuits.com
138 Upvotes

r/PowerShell • • Jan 26 '21

PowerShell Remoting: The Ultimate Guide

138 Upvotes

Hey guys,

u/ /r/ps_tyler just wrote a shiny new blog post you may enjoy.

"PowerShell Remoting: The Ultimate Guide"

Summary: How does PowerShell Remoting (PSRemoting) work? What authentication options are available? Learn this and more in this ultimate guide.

https://adamtheautomator.com/psremoting/


r/PowerShell • • Oct 22 '19

Thanks to this subreddit, I finally finished my first ever GUI project that clones VMs from templates!

138 Upvotes

This is the initial screen.

This is the GUI after everything is filled out.

Basically, it takes a template and clones from it multiple times.

Some features I like about it:

  • It tells you how much free storage you have in the selected datastore.

  • It tells you how much storage will be left in the DS after the cloning process is done.

  • It allows picking a folder to clone to by looking it up using the "find folder button".

  • If you environment is like ours, where you clone Linux VMs to Linux datastores, and Win VMs to seperate datastores, then clicking "Fetch" in the OS menu populates the other fields based on that selection. Same for the customization templates.

  • If you name your VM "RedditTest01" and choose 3 VMs to clone, then each new VM will have a new name by adding 1 to the number, so it will be RedditTest02, RedditTest03 and so on..

It took me some time to finish this, as I don't really know PS, but it was fun and I actually got to use it in my job!

Thank you so much for the help, and special thanks to https://poshgui.com. They're the best :)

Edit:

Here's the github page


r/PowerShell • • Jun 04 '23

Information Want to learn how to work with APIs?

137 Upvotes

Hey Powershell peeps!

You learn far more by doing than by just listening.... Join Devin Rich this Wednesday evening as he takes you on a hands-on, guided tour of working with APIs in PowerShell.

All skill levels welcome! Time and connect info are in the meeting notes... follow link for details.

https://www.meetup.com/research-triangle-powershell-users-group/events/293877891/


r/PowerShell • • Jul 26 '18

Windows Admin Center (formerly Project Honolulu) Functions on GitHub

137 Upvotes

Windows Admin Center is a nice Web-based GUI that you can use to manage your servers in your Windows environment. The majority of information displayed on every page comes from PowerShell functions. You can view those PowerShell functions by clicking the the PowerShell icon in the top-right corner of any given page that you're on.

I grabbed all of those PowerShell Functions and placed them in a public GitHub repo so that folks can use them in other contexts (which is explicitly allowed by Microsoft).

https://github.com/pldmgg/WinAdminCenterPS

There are a lot of really useful functions as well as some...questionable ones. But overall, it's a really good collection.

Hope this can help some folks out!

Maybe Microsoft can publish all of these in their own GitHub repo so that they can be kept up to date :)


r/PowerShell • • Apr 14 '26

PowerShell MSI installer deprecated on Windows in favor of MSIX

136 Upvotes

r/PowerShell • • Apr 15 '21

Question What do you guys do to setup Visual Studio Code for PowerShell?

136 Upvotes

Hi everyone! I've been fooling around with Visual Studio Code and the PowerShell extension and wanted to see how everyone else configured theirs. Some drawbacks I've noticed is that Intellisense won't pickup some imported module arguments (looking at you MSGraph) within the scripting pane. What's your experience? Have any tips on making it a full replacement for PowerShell ISE? Thanks!

Edit: Here's an example of my settings.json:

"editor.defaultFormatter": "ms-vscode.powershell",
"editor.tabCompletion": "on",
"files.autoSave": "off",
"workbench.iconTheme": "vs-seti",
"files.defaultLanguage": "powershell",
"powershell.integratedConsole.focusConsoleOnExecute": false,
"powershell.integratedConsole.showOnStartup": false,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,
"files.trimTrailingWhitespace": true,
"files.encoding": "utf8bom",
"files.autoGuessEncoding": true,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"

I set the integrated shell this way since I want to respond to modern authentication requests.

Can you guys think of anything else I should add?


r/PowerShell • • Apr 04 '21

Script Sharing CI CD for PowerShell scripts in Active Directory environments

135 Upvotes

For anyone who is looking for simple solution to:

  • automate whole scripting content life cycle (validation, distribution, customization, deletion)

  • easily share functions with your colleagues

  • generate modules (from ps1 scripts)

  • unify your PowerShell environment

  • have global PowerShell variables that you can use in any function or script

  • have all code in your environment in one place

  • check your code before commiting it (syntax errors, best practices, compatibility, custom checks, ...)

  • enforce formatting etc through VSC workspace settings

  • sign your PowerShell files

  • distribute any code content to any client and to any location in your AD (or AAD) i.e. can be used for storing startup GPO scripts, SCCM install script, you name it

  • automatically create sched. tasks

  • ...

Other useful information:

  • no paid tools needed

  • installer included (written in PowerShell of course 😁)

  • incredibly simple to use

  • built on top of GIT (no GIT knowledge needed)

  • written completely in PowerShell (i.e. easy to customize)

  • idiot-proof (it won't let you commit changes in your functions / global variables that would break some dependent code)

  • there is function (Refresh-Console) to import new functions/variables to existing PS console

  • PS console title shows how far behind is such console in number of commits

  • possibility to distribute chosen content to AAD joined clients / separate git repository (not yet published)

If you are interested, please check out my GitHub repository or use case examples.

If you want to test features of this solution in safe manner in under 5 minutes, check this out.

If you prefer watching video, you can check these short videos with some features overview (new function, new variable, script validations) or little longer introduction video (sorry for my english :D)

Btw I will be grateful for any feedback (even negative) or feature requests :-)


r/PowerShell • • Dec 16 '19

Some PowerShell Spotted on Tonight's Episode of Mr. Robot

135 Upvotes

I may have missed it, but I don't think I've seen any PowerShell use on the show yet. Nice to see it make an appearance =)

Imgur