r/PowerShell • • Nov 29 '19

Back to Basics: Understanding PowerShell Objects

131 Upvotes

Hey guys, Bill Kindle just wrote a shiny new blog post you may enjoy.

Summary: In this back to basics article, Bill Kindle covers PowerShell objects including object properties, methods and how to work with them.

https://adamtheautomator.com/powershell-objects/?utm_source=redditpowershell&utm_medium=social&utm_campaign=newblogpostnotifications


r/PowerShell • • Nov 29 '18

Why doesn't powershell give us a tool to automate this?!

Thumbnail
gfycat.com
131 Upvotes

r/PowerShell • • May 21 '25 Helpful

Free directory tree visualizer for PowerShell I made with sorting, filtering, metadata, and more called PowerTree.

130 Upvotes

What is PowerTree

PowerTree is a free and open source directory tree visualizer for PowerShell (7+). It lets you display folder structures with optional file sizes, timestamps (created, modified, accessed), and attributes. You can filter by file extension, size range, or exclude specific folders, and sort by name, size, or date.

Output can be saved to a file or just viewed in the terminal, and there's a built-in config system to set your default behavior. Like excluded folders, default sorting and max depth limits.

More information

GitHub

How to install

Install-Module PowerTree


r/PowerShell • • Aug 01 '24

Misc Sharing tips & tricks that you think everyone already knows and you feel like an idiot?

130 Upvotes

I was wondering if there were some things that you (maybe recently) discovered and thought "oh shit, really? Damn, I'm an idiot for only realizing now".

For me it was the fact that you can feed Powershell a full path (e.g. c:\temp\logs\ad\maintenance) and have it create all folders and parent folders using new-item -force.

I did not know this and was creating every single folder separately. Lot of time wasted.


r/PowerShell • • Sep 29 '23

Question What non-sysadmin tasks have you used Powershell for, both in your work (and perhaps personal) life? Whether it be gaming, web-based extensions, etc?

130 Upvotes

I understand where Powershell excels, typically sys admin tasks in Windows, but I'm curious where you guys have used it outside of that kind of stuff and what you've built or are working on.

Like, would it ever be useful in gaming? Would you ever use it in combination with tools like youtube-dl? Do you do anything that's web-based where it helps or excels or just makes your life easier?


r/PowerShell • • Apr 23 '21

How to Sign a PowerShell Script (And Run It)

130 Upvotes

Hey guys,

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

"How to Sign a PowerShell Script (And Run It)"

Summary: Are you wondering what script signing is and how to distinguish a signed script from a non-signed one? Look no further! In this article, you'll learn how to sign PowerShell scripts using digital certificates.

https://adamtheautomator.com/how-to-sign-powershell-script/


r/PowerShell • • Feb 20 '20

Script Sharing Active Directory DFS Health Check with PowerShell

130 Upvotes

Last few months I've been working on 2 PowerShell modules - ADEssentials and Testimo. One provides detailed, fully automated commands to deliver different AD cmdlets. The other one uses those to deliver automated reporting.

Extended information in the blog post: https://evotec.xyz/active-directory-dfs-health-check-with-powershell/

Sources for both:

With Get-WinADDFSHealth command you can a simple summary of your DFS Health

But also additional details you can expand on

Invoke-Testimo, on the other hand, delivers the results in form Pass/Fail making it easy to quickly asses if your DFS is working or not without spending more then 5 minutes per day on it.

And if you're really into full report - Invoke-Testimo does that as well

But it also is able to do a lot more as you can tell it to run multiple reports at once:

Invoke-Testimo -Sources DCDFS,DCLDAP,DCLDAPInsecureBindings,DomainGroupPolicyMissingPermissions -ShowReport

And that is just the tip of an iceberg.

Hope you like this one. Both ADEssentials and Testimo are under Active development.


r/PowerShell • • Apr 02 '19

Dashimo - PowerShell Generated HTML Dashboard in a single file

130 Upvotes

Something that may come useful to you guys. Recently I've written Dashimo which allows creating HTML dashboards in a very easy, intuitive way. With it, you no longer have to build an object and then play with HTML to get it to display correctly in HTML.

The whole idea with screenshots is described in my blog.

https://evotec.xyz/meet-dashimo-powershell-generated-dashboard/

Dashimo generates a single HTML file that you can attach to email or host on a website. There is no DB or anything else. Keep in mind this can't be used as Email Content because it holds JS and heavy CSS. But you can attach it to email and the features it holds within that HTML are well worth it.

On my blog, I'm explicitly showing it using my Active Directory module but you can pass anything to Table. Even $Object = Get-Process if you really want to.

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard.html {
    Tab -Name 'Forest' {
        Section -Name 'Forest Information' -Invisible {
            Section -Name 'Forest Information' {
                Table -HideFooter -DataTable $DataSetForest.ForestInformation
            }
            Section -Name 'FSMO Roles' {
                Table -HideFooter -DataTable $DataSetForest.ForestFSMO
            }
        }
   }
} 

The easiest sample looks like this.

$Process = Get-Process | Select-Object -First 30

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard1.html {
    Section -Name 'Test' {
        Table -DataTable $Process
    }
}

You can have as many sections/panels as you need. Tabs also work just fine. Charts are coming sometime soon.


r/PowerShell • • Feb 15 '19

IT Manager and Sys Admin does not like powershell

130 Upvotes

I do not know if this is the right place to post...

So I have been working as a help desk tier 1-2 for this company for about 6 months now. There are a lot of manual labors that I see that could be a perfect opportunity to test out and learn powershell. So I did study here and there and came up with all the scripts for our termination process. Fast forward to today, we had to fire bunch of people since we were downsizing. I told my manager and sys admin that I have a scrip that they could utilize to automate all the process so that they do not waste time manually doing everything. They asked for the script and I sent it to them. An hour later, I still see them doing it manually. They kind of just seemed to not care for it? Maybe they are looking down on me as a help desk so I am not worthy of their acknowledgement? I did kind of get hints that our IT department is really not that trendy and keeps up to date of what is hot in IT and all but this just seems ridiculous to me.

I don't know. What do you guys, as IT professionals think about this? I just wanted to hear your opinions and rant a little.

EDIT: Many people are asking if there was an error in the script or they are scared that it might touch something it shouldn't but I unfortunately tested this many times before bringing up to them since the last thing I want them to do when they run this script is showing errors. I just wished they trusted me more as their team, that is what makes me kind of sad at this point.


r/PowerShell • • Feb 06 '18

A PowerShell Success Story (and a thank you!)

130 Upvotes

Hello r/PowerShell!

I don't post too often here (or on Reddit in general for that matter), but I certainly read this sub. I love PowerShell. Such a fantastic thing.

My success story is that PowerShell landed me a pretty great job. I started learning last April (I actually wrote my first PS script on Good Friday), so in less than a year, I've learned the product enough to feel proficient, list it on my resume, talk about it through the interview, and land a job using this skillset (which came with over a 25% increase in salary!).

I'm currently working for an Enterprise, troubleshooting and fixing failed SCCM clients. However, my organization relies heavily on an in-house PS toolkit. Because of that line on my resume, I was hired, and now I've spent probably 80% of my working time refactoring old code and writing new code.

I've been in the role for just over a month, and I'm still excited about it. For those of you just getting started, keep at it! It's a skill for which the demand is growing and the adoption rate is still kind of slow. And, it's a lot of fun. A valuable skill to have, for sure!

And thanks, r/PowerShell, for silently being with me every step of the way.


r/PowerShell • • Aug 27 '26 Mindblown

Script Sharing XKCD PowerShell module

129 Upvotes

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 • • Mar 19 '26

PowerShell 7.6 is released

129 Upvotes

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 • • Sep 04 '24

Script Sharing PowerShell scripts for managing and auditing Microsoft 365

129 Upvotes

Here's is a hundreds of scripts tailored for managing, reporting, and auditing Microsoft 365 organizations. Most of the scripts are written by myself and these are perfect for tackling the day-to-day challenges. For example,

  • Assigning and removing licenses in bulk

  • Finding and removing external email forwarding

  • Identifying inactive users

  • Monitoring external sharing

  • Tracking file deletions in SharePoint Online

  • User sign-in activities,

  • Auditing email deletions

  • Room mailbox usage

  • Calendar permission reports

  • Teams meetings attended by a specific users, etc.

And, these scripts are scheduler-friendly. So, you can easily automate the script execution using Task Scheduler or Azure Automation.

You can download the scripts from GitHub.

If you have any suggestions and script requirements, feel free to share.


r/PowerShell • • Aug 29 '24

Question I have to learn PowerShell in four months. Where do I start?

129 Upvotes

Unfortunately, one of our Systems Engineers is being let go and he's a PowerShell expert. He's written a ton of scripts responsible for automation.

Our team will have to divvy up his tasks and bring ourselves up to speed to address the skill gap--PowerShell being one such skill.

What books, videos, interactive learning sites, etc. will give us the most bang for our buck? I don't expect us to be experts, but a moderate level of understanding would go a long way to help us troubleshoot and author processes.


r/PowerShell • • Jun 14 '21

Script Sharing Fully automated RDP connection using LAPS password and PowerShell

Thumbnail
doitpsway.com
129 Upvotes

r/PowerShell • • Mar 10 '21

And today in "Making IT security professionals cry"

129 Upvotes

So background: This month my team are having a bit of a tidy-up/purge of our Azure Automation account. There's hundreds of runbooks in there assigned to dozens of different schedules, tons of duplicates and stuff people made then left sitting "in edit". Very nasty.

I was browsing down the list and I found one made by a former colleague who has now left the business. It's a powershell runbook, so no problem, I think to myself.

I was wrong. (Names have been changed to protect the guilty)

$cred = Get-AutomationPSCredential -Name 'domainadmin'
New-PSDrive -name 'Q' -Root '\\UNCpath\touserfolder\that\is\open\to\all\users\'
Set-Location Q:\
$process = Start-Process -FilePath C:\Python37\python.exe -ArgumentList .\pythonscript.py -NoNewWindow -Wait -Credential $cred
$errorcode = $process.ExitCode
if($errorcode -ne 0){
Write-Error -Message "Error: $errorcode" -Category NotSpecified
   throw "Python script returned an error"
} else {
   Write-Output "Exit Code: $errorcode"
}

I can't. I just can't. This is just too disgusting.

This is now top of my list of things to replace with something that won't make the head of security cry bitter, salty tears.


r/PowerShell • • Jul 11 '19

Script Sharing UPDATE: I had posted my O365 Audit Tool here, and you guys gave some great feedback, which I've implemented! Any more feedback would be awesome!

Thumbnail
gitlab.com
129 Upvotes

r/PowerShell • • Dec 19 '18

Script Sharing Off-boarding script for users - AD & Exchange

129 Upvotes

This was originally posted in the SysAdmin sub under another user's thread in answer to a question about other admins' off-boarding processes and practices.
(https://www.reddit.com/r/sysadmin/comments/a7btgh/what_is_your_offboarding_process/)

However, I got so many requests to post a link to the finished script that I thought I'd offer it here, too. Download link is towards the bottom.

Prior to my joining my present company our off-boarding process was that the IT guy, my predecessor - a singular IT guy for a multinational, multi-million dollar per year company, mind you - would get an emailed form telling him that so-and-so was leaving the company. However, from what I could tell, he never really did much about it after that. Old users were left in Active Directory, their email accounts were still active, etc.

When I came on board I quickly changed all that. I did an audit to find and get rid of old Active Directory accounts that hadn't been logged into for 6 months or more, exported the names to a text file and sent them to HR to look over. I then got rid of the ones that had been confirmed vacated. I did the same with the email accounts and then started writing an off-loading script with Powershell to securely out-process folks going forward. This powershell script does the following:

Active Directory Section:

* Asks admin for a user name to disable.

* Checks for active user with that name.

* Disables user in AD.

* Resets the password of the user's AD account.

* Adds the path of the OU that the user came from to the "Description" of the account.

* Exports a list of the user's group memberships (permissions) to an Excel file in a specified directory.

* Strips group memberships from user's AD account.

* Moves user's AD account to the "Disabled Users" OU.

Exchange email section:

* Asks how to deal with the user's email account.

* Admin chooses one or more of the following:

(1) forward the user's emails to another user

(2) set a reminder to delete the user's account at a certain date and time (30, 60, 90 days)

(3) disable the user's account immediately (30 day retention)

(4) set the mailbox to block incoming emails

(5) leave it open and functional as is.

* Executes said choice, including setting a local reminder in Outlook for admin if needed.

* Sends email to HR confirming everything that has been done to user's account.

We still get the emailed form, but I think this is a much better off-boarding process than what used to happen. I also created an on-boarding script that is easily twice as long and steps through many more procedures. Gotta love automation!

Since I've had multiple new requests to post the script again, here's a permalink to TinyUpload.

http://s000.tinyupload.com/?file_id=96021645875686796646

Warning: this script will NOT work for you in its present form. I've "genericized" it, scrubbing it of all personally and professionally identifying information. So, you'll need to go through the entire script, line by line, and edit certain things to make it fit with your environment. Take it slow and make sure you understand what the script does BEFORE you run it on your network. My suggestion would be to break it down into separate parts in order to edit and test individually.

Obligatory legalese fine print:
I take no responsibility for anyone doing damage to their machine or network through their own negligence, incompetence, or by not heeding the above warning. I am also not responsible for any future software support for this product. It is offered AS-IS. Use at your own risk.


r/PowerShell • • Sep 16 '18

Script Sharing PSWinReporting - Monitoring active directory events and sending it to Email, Microsoft Teams, Slack, SQL

129 Upvotes

For those who don't know this module it's purpose is simple - monitoring Active Directory for events such as creating new users, adding users to groups, deleting users and so on. If you've ever wondered who added this guy to Domain Admins this tool can tell you.

By default (the old version) it was only able to send it to Email with nice reports. New version adds:

  • Support for Event Forwarding – monitoring one event log instead of scanning all domain controllers

  • Support for Microsoft Teams – Sending events as they happen to Microsoft Teams (only supported when forwarders are in use)

  • Support for Slack – Sending events as they happen to Slack (only supported when forwarders are in use)

  • Support for Microsoft SQL – Sending events directly to SQL (some people prefer it that way) - including create table, alter table and insert rows with table mapping in place

  • Support for backing up old archived logs (moves logs from Domain Controllers into chosen place)

  • Support for re-scanning logs from files – a way to recheck your logs for missing information

The last one is still in progress but should be usable soon.

Blog about new release (how to and so on): https://evotec.xyz/pswinreporting-forwarders-microsoft-teams-slack-microsoft-sql-and-more/

Module page: https://evotec.xyz/hub/scripts/pswinreporting-powershell-module/

Sources are on GitHub, and installable from PowershellGallery (preferred way). It utilizes following modules for different functionalities (available on github/powershellgallery)


r/PowerShell • • May 29 '21

I released a first version of a better robocopy Wrapper

128 Upvotes

https://github.com/renevaessen/GenXdev.FileSystem/

Making it a NuGet package will follow later.


r/PowerShell • • Jul 27 '19

Script Sharing 1-2 player strategy game, in powershell

128 Upvotes

Hey all, I made a video game in powershell and figured the people here might like it. It's free and open source, of course, and you can download it as a zip from here:

https://mediumcharlie.itch.io/arrrrg

(There is an option to donate but you should just skip that)


r/PowerShell • • Jan 26 '18

Script Sharing ps-spotify - control Spotify from PowerShell

Thumbnail
github.com
128 Upvotes

r/PowerShell • • Jul 18 '17

Slow Code: Top 5 Ways to Make Your PowerShell Scripts Run Faster

Thumbnail
blogs.technet.microsoft.com
128 Upvotes

r/PowerShell • • Jul 12 '26

Misc I love watching AI use powershell

127 Upvotes

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.