Finally got around to releasing LeastPrivilegedMSGraph 2.0.0
Which now includes least privileged msgraph permissions reccommendations for service principles/ manged identities for both application and delegated scopes.
This is really awesome. I was just looking into the best way to find least privilege across my admin roles but had no idea how to tackle enterprise apps. Then I just happened to read this post! Setup was a little tricky, but your blog post got me through it. Thank you for making this!
Looks interesting. The cost analysis section looks a bit off though. Still it’s insane how much it costs to host these logs. Wonder if that is the biggest hinderance.
But basically it is a auditing tool for service principles / managed identities / delegated msgraph permissions in Entra/Azure to help reduce the amount of permissions assigned and remove those that is not used.
I replaced my ZSH setup with my battletested Windows $PROFILE on a fedora 43 test workstation. Powershell works perfect. It really shines with linux ;)
Started month 2 learning powershell. I’ve been creating more reporting scripts to easily pull lists of things from Intune, Entra ID. This week I have two change requests to automate offboarding devices and stale device clean up! That -whatif parameter sure is nice to TEST TEST TEST.
Be careful with whatif. It only does the "if" part if the code is written correctly to utilize it. This means it is very possible to run a command with the whatif switch and have it make entirely unexpected changes. Moreover, since they had to at least try to include it, it may just be a subset of the actions that command makes, which can make it a nightmare to backtrack.
This month in PowerShell, I built a self-healing monitor that: Restarts services immediately if they are "Stopped". Restarts services if database activity is stale or "hung". Automatically skips SQL checks for services that don't use a database. Reboots the whole server only if a service restart fails (max once daily). Uses cooldowns and state-tracking to prevent infinite restart cycles. Sends SMTP email notifications for every recovery action.
Made the tiniest script in the world that takes a country name from the clipboard, searches a hashtable for the corresponding country code and puts the code back onto the clipboard.
It means now I can work around the lack of advanced scripting in my work’s version of Nuance Dragon and carry out a workflow that is slow and clunky and reduce the number of commands I have for one single action from about 90 commands down to two (basically one for each country code).
What I love the most was that the specific reason I was given for not having advanced scripting was that IT don’t want us playing around with stuff that can break the network.
When you say decommission, did you uninstall Exchange from the server? What kind of environment do you have? Is AD synchronization being done with Entra Connect? Normally, Exchange should not be uninstalled; the server should only be powered off.
Sorry, missed this. We uninstalled exchange on both servers. All of the exchange attributes stay in AD anyway so we've spun up a management server with exchange tools on it to manage that side of things, that's all being done via powershell now too.
Created a couple of scripts to fix our RMM agent when it breaks, one uninstalls it and cleans up the system of all traces of it, and the other downloads the agent from a URL for the appropriate site (using a -sitecode parameter) and installs it.
Oh that sounds interesting. Our MSP uses Datto RMM, and while I have some amount of admin access I'm never sure if the agent is working right or not. Can you elaborate on how to tell, and share a sanitized version of the script?
I built a little script that queries our Palo Alto Panorama management plane, and all of our firewalls, using read-only API keys, to display a summary of platform health, including age of the various apps and threats, antivirus, and wildfire content. Saves me having to log into the web UI to poke around.
I used it to remove some unapproved apps installed from the Microsoft Store through MCM and clean up the orphaned desktop shortcut (if there was one). I want to spend more time learning to make it more automated and scalable though by maybe turning it into a script that can be used on a collection in MCM rather than just running the code in an interactive PS window in MCM for individual devices.
Built an automation that get device tags from MS defender, and push that tag as an extension attribute in the corresponding EntraID device. All of that with the purpose of using entra dynamic groups to scope the device policies in ms Defender
Built custom Write and Read logging functions that store logs as JSON lines in JSONL format to be used across all of our infrastructure automations. Makes for easy sending of logs to log analytics workspaces from our Azure Automation runbooks.
At work, we have devices that aren’t not domain joined. One of our security tools detected CVEs for SMBv2 Signing Not Required. After extensive research, I found that I can still utilize WinRm on said devices, so I enabled it and then made a script that uses invoke-command to remediate all of the vulnerable machines. Now looking to rollout setting up the rest of these non-domain joined devices with WinRm and then using HTTPS as an extra security measure
Deployed a module with a bunch of custom functions I use regularly for my team mates to leverage. Created a few onboarding/offboarding functions for my team mates so we could stop using a service to do so. Gave me my first experience with leveraging Graph.
Finally got a central deployment rust enterprise script rolling. Took a few weeks and then AI to add some extra conditions checks and write back to encrypted fields
Lots of work with REST APIs and I spent some time making PSReadline more part of my flow. Using hotkeys I already knew about and create some helpful/fun Key Handlers
I have reset all of the passwords of disabled accounts to an each hanging a random 25 character password with upper and lowercase letters, numbers, &special characters.
The repo is a cross-platform set of PowerShell profile helpers, and this change adds YAML-backed alias management so aliases can be loaded automatically at session startup instead of being hardcoded in $PROFILE.
What’s new
als snippet alias for managing aliases
aliases.yml support with optional $env:SnippetsAliasesYaml override
Plain aliases and wrapper aliases
Parameterized wrapper aliases
Add-SnippetsAlias, Get-SnippetsAlias, Update-SnippetsAliases, etc.
New-SnippetsAliasEntry for working with alias rows as objects
Existing commands are skipped on startup instead of being overwritten
Started to tidy up little script i wrote to harvest account lockout log entries from domain controllers, and ended up turning it into a function that can be used to run custom searches on windows event logs across multiple servers, format it into a more human readable output, and display varying levels of data on screen and/or export it to CSV.
Default behavior is still to get the account lockout summary info and display on-screen, though.
This month, I created a micro-service that syncs workday photos to office over the graph API. Could I have done it in another language, yes, but I did it in PowerShell so my team could manage it after I’m no longer working there.
Edit: I also modified some modules I made for working with Ivanti’s API to include some new attributes on SR generation.
And built some API code to connect to and read information from Sailpoint’s API
Ohhh also built some report code that reads data from OKTA’s API and builds reports.
Last reply before the post ends? (In 10mins it's April 2nd for me)
Created a small module that talks to the zscaler API and pulls back some otp codes to allow us to manage the local client easier without having to go through their 50 f****** portals
26
u/420GB Mar 01 '26
I cursed its name
9
u/-Mynster Mar 01 '26
Finally got around to releasing LeastPrivilegedMSGraph 2.0.0
Which now includes least privileged msgraph permissions reccommendations for service principles/ manged identities for both application and delegated scopes.
Official post here.
https://www.linkedin.com/posts/mortenmynster_powershell-mggraph-leastprivilege-activity-7432168265147330560-2lH6?utm_source=social_share_send&utm_medium=android_app&rcm=ACoAACHMLkMB23fOg-wqKD9C0uIVe252G5cWi9Y&utm_campaign=copy_link
8
u/TjomasDe Mar 01 '26
I replaced my ZSH setup with my battletested Windows $PROFILE on a fedora 43 test workstation. Powershell works perfect. It really shines with linux ;)
8
u/Ajamaya Mar 01 '26
Started month 2 learning powershell. I’ve been creating more reporting scripts to easily pull lists of things from Intune, Entra ID. This week I have two change requests to automate offboarding devices and stale device clean up! That -whatif parameter sure is nice to TEST TEST TEST.
5
u/JVAV00 Mar 01 '26
Created a script call an api from some password generator
5
u/FareedKhaja Mar 01 '26
This month in PowerShell, I built a self-healing monitor that: Restarts services immediately if they are "Stopped". Restarts services if database activity is stale or "hung". Automatically skips SQL checks for services that don't use a database. Reboots the whole server only if a service restart fails (max once daily). Uses cooldowns and state-tracking to prevent infinite restart cycles. Sends SMTP email notifications for every recovery action.
5
u/Sirenskye Mar 01 '26
Made the tiniest script in the world that takes a country name from the clipboard, searches a hashtable for the corresponding country code and puts the code back onto the clipboard.
It means now I can work around the lack of advanced scripting in my work’s version of Nuance Dragon and carry out a workflow that is slow and clunky and reduce the number of commands I have for one single action from about 90 commands down to two (basically one for each country code).
What I love the most was that the specific reason I was given for not having advanced scripting was that IT don’t want us playing around with stuff that can break the network.
3
u/ResitPro Mar 01 '26
It’s very simple but I found you can queue uninstalling programs instead of one by one. Removed the whole adobe suite and just let it whirl :)
3
u/The_Vore Mar 01 '26
Decommissioned our last two Exchange Servers
3
u/Own_Palpitation_9558 Mar 01 '26
Built two things, both ninja scripts
One automates hp and Lenovo driver and firmware updates.
The other is a full refactor of the eset dem plugin, that’s makes it work better from my needs and sets some scaffolding up for future features.
2
u/Akai-Raion Mar 01 '26
Created a couple of scripts to fix our RMM agent when it breaks, one uninstalls it and cleans up the system of all traces of it, and the other downloads the agent from a URL for the appropriate site (using a -sitecode parameter) and installs it.
2
u/gruntbuggly Mar 01 '26
I built a little script that queries our Palo Alto Panorama management plane, and all of our firewalls, using read-only API keys, to display a summary of platform health, including age of the various apps and threats, antivirus, and wildfire content. Saves me having to log into the web UI to poke around.
2
u/ThorinSmokenshield Mar 01 '26
Simple script to disable either the Ethernet or WiFi adapter, depending on the ask.
2
u/oftheunusual Mar 01 '26
I used it to remove some unapproved apps installed from the Microsoft Store through MCM and clean up the orphaned desktop shortcut (if there was one). I want to spend more time learning to make it more automated and scalable though by maybe turning it into a script that can be used on a collection in MCM rather than just running the code in an interactive PS window in MCM for individual devices.
2
u/digsitependant Mar 01 '26
Found a "lost" folder within a shared mailbox.
1
u/Dami01_ Mar 01 '26
Built an automation that get device tags from MS defender, and push that tag as an extension attribute in the corresponding EntraID device. All of that with the purpose of using entra dynamic groups to scope the device policies in ms Defender
1
u/chaosphere_mk Mar 01 '26
Built custom Write and Read logging functions that store logs as JSON lines in JSONL format to be used across all of our infrastructure automations. Makes for easy sending of logs to log analytics workspaces from our Azure Automation runbooks.
1
u/Last-Pace4179 Mar 01 '26
At work, we have devices that aren’t not domain joined. One of our security tools detected CVEs for SMBv2 Signing Not Required. After extensive research, I found that I can still utilize WinRm on said devices, so I enabled it and then made a script that uses invoke-command to remediate all of the vulnerable machines. Now looking to rollout setting up the rest of these non-domain joined devices with WinRm and then using HTTPS as an extra security measure
1
u/HelloFelloTraveler Mar 01 '26
Deployed a module with a bunch of custom functions I use regularly for my team mates to leverage. Created a few onboarding/offboarding functions for my team mates so we could stop using a service to do so. Gave me my first experience with leveraging Graph.
1
u/ben_zachary Mar 01 '26
Finally got a central deployment rust enterprise script rolling. Took a few weeks and then AI to add some extra conditions checks and write back to encrypted fields
1
u/marcolio17 Mar 02 '26
Used it to cross reference an instrumentation construction submittal instead of going line by line on a PDF. Saved my life!
1
u/leebo_28 Mar 03 '26
./
1
u/Rx-xT Mar 04 '26
Disabled RDP on endpoints that had it exposed to the internet lmao
1
u/Andrew-Powershell Mar 05 '26
Lots of work with REST APIs and I spent some time making PSReadline more part of my flow. Using hotkeys I already knew about and create some helpful/fun Key Handlers
1
u/Eggplate Mar 06 '26
I got chrome/edge to be controlled by powershell alone without external libraries like playwright/puppeteer/selenium.
1
u/Quejua Mar 08 '26
I have reset all of the passwords of disabled accounts to an each hanging a random 25 character password with upper and lowercase letters, numbers, &special characters.
1
u/RealSharpNinja Mar 11 '26
Added a YAML-backed alias manager to my PowerShell profile snippets repo
I just pushed a new alias manager to my PowerShell snippets repo:
GitHub PS-Services/Snippets
The repo is a cross-platform set of PowerShell profile helpers, and this change adds YAML-backed alias management so aliases can be loaded automatically at session startup instead of being hardcoded in
$PROFILE.What’s new
alssnippet alias for managing aliasesaliases.ymlsupport with optional$env:SnippetsAliasesYamloverrideAdd-SnippetsAlias,Get-SnippetsAlias,Update-SnippetsAliases, etc.New-SnippetsAliasEntryfor working with alias rows as objectsExample YAML
Example usage
Then:
That persists back to YAML immediately, and
als reloadre-reads the file into the current session.If you use YAML-driven profile config, I’d be interested in feedback on the command surface and schema.
1
u/YasinHamad Mar 14 '26
Generate the constructor/getters/setters for a class in my OOP course.
1
u/Dixielandblues Mar 19 '26
Started to tidy up little script i wrote to harvest account lockout log entries from domain controllers, and ended up turning it into a function that can be used to run custom searches on windows event logs across multiple servers, format it into a more human readable output, and display varying levels of data on screen and/or export it to CSV.
Default behavior is still to get the account lockout summary info and display on-screen, though.
1
u/itscum Mar 20 '26
Made a distance tracer for mouse movements. Has GUI can be calibrated for different dpi and saves the last measurements. GitHub
1
u/434f4445 Mar 28 '26 edited Mar 28 '26
This month, I created a micro-service that syncs workday photos to office over the graph API. Could I have done it in another language, yes, but I did it in PowerShell so my team could manage it after I’m no longer working there.
Edit: I also modified some modules I made for working with Ivanti’s API to include some new attributes on SR generation.
And built some API code to connect to and read information from Sailpoint’s API
Ohhh also built some report code that reads data from OKTA’s API and builds reports.
1
u/BlackV Apr 01 '26
Last reply before the post ends? (In 10mins it's April 2nd for me)
Created a small module that talks to the zscaler API and pulls back some otp codes to allow us to manage the local client easier without having to go through their 50 f****** portals
-3
u/uniquerunner Mar 01 '26
I have been building PSMUX - The Native Tmux for Powershell. No WSL. No Workarounds!
https://github.com/marlocarlo/psmux
Includes Themes+Plugins support. 👍If you like it, ⭐ the repo and share. Thank you 🙏
1
u/[deleted] Mar 08 '26
[removed] — view removed comment