r/PowerShell • u/Ajamaya • Mar 09 '26
Question Organizing scripts
Hello! I was curious how others are organizing and /or documenting their scripts. I have scripts in GitHub, OneNote, Notepad++ you name it. I keep seeing clips of using Jupyter polyglot notebooks but understand it’s about to be deprecated? Wondering what is a good way to consolidate and also have others such as help desk access.
51
Upvotes
25
u/raip Mar 09 '26
Definitely recommend a Powershell repo. Ours is file based. After you register it, you interact with it just like Powershell Gallery. It's got versioning, meta data, and with the Find-* modules and good naming, it's easy to find stuff.
15
u/Secret_Account07 Mar 09 '26
Interested in these answers as my scripts are so unorganized lol
Everyone on my team uses a different method/repo
9
u/E8zPQrX7rwkd Mar 09 '26 edited Mar 09 '26
Our department has a repo in Azure DevOps. It's not free (first five users free, $6 per user per month after that), but the value it brings us justifies the cost for us.
You can add it to a workspace in VS Code, which makes it easy to search for and browse the scripts. We organise the scripts into folders based on process or service, then where it is run (Azure Automation, Azure Logic App, locally run), then the script itself. Because each script has its own folder, you can put a README.md in the folder along with the script to document what it does or how it works. For scripts we run on demand on our computers, we put the documentation into the script itself.
Members of the department have contribute permissions, while a large number of people outside the department have read only permissions, i.e. they can read and open scripts in VS Code, edit them locally and run them, but cannot overwrite what we have in the repo.
Our structure looks something like this.
4
u/tokenathiest Mar 09 '26
Here's a couple examples from my public GitHub repos. I consolidate scripts into repos or modules then use the README.md Markdown file to document them, or for larger projects use GitHub Docs which is very useful for generating HTML documentation from Markdown and akaik works in public and private repos. I start with internal comments inside the scripts which I then promote to Markdown.
Readme Example: https://github.com/ShwaTech-LLC/ShwaTech-SysTools
GitHub Docs Example: https://github.com/chopinrlz/powerpass (scroll down to More Information)
7
u/Alekspish Mar 09 '26
I created a powershell module to import scripts,notes and one-liners to a github repo. Makes it easy to mamage and it gives a menu in the terminal to browse the scripts and run them or create a command to paste in another server so you can download and run the script there.
3
u/Federal_Ad2455 Mar 10 '26
Git repository managed via cicd pipeline to automatically deploy modules, profiles etc to servers /admin stations
https://github.com/ztrhgf/Powershell_CICD_repository
2
u/purplemonkeymad Mar 09 '26
For personal use (ie just me) I use a self hosted forge for source, and visualstudio aritfacts via a personal Ms account for a personal PS repository.
For work we have a forge and manually update.
For public interest stuff it goes up on github.
2
u/Antoine-UY Mar 09 '26
I use Warp
2
u/tentoesdown7 Mar 09 '26
I just have a pwsh folder in my c drive lol are these ways better? Why would I keep my scripts in a git repo if using for work and not trying to show them off? Genuinely curious
2
u/icepyrox Mar 10 '26
I write my scripts in Visual Studio Code. I have installed Git for Windows. Our team has an on premium version of Azure DevOps (ADO).
So I have 3 repos on my computer:
As for documentation and whatnot: I do use comment based help to remember what a script does, but also VSCode supports markdown, so I have .MD files in folders with scripts im working on to make myself notes on what its actually doing.
I think the most common file name repeated all over these repos is Bookmarks.md where I just have lists of bookmarks to code snippets and stackoverflow where im looking up how to approach a script and saving for later since computers get logged out nightly.
2
u/justaguyonthebus Mar 09 '26
I have a personal git repo for all my chicken scratch scripts that really shouldn't be seen or ran by anyone else yet. Then have a team or department git repo where stuff gets used and possibly worked on by others. If you reference it in documentation, it no longer belongs in your personal repo.
Start setting up automation/pipelines on the team repo to publish scripts where they need to go. Start with a read only file server if you don't want people going directly to git if they don't need to.
1
u/Awkward-Secretary726 Mar 09 '26
Obsidian + Zettelkasten, just apply the right metadata — date, alias, tags, description — and that's all you need.
1
u/BlackV Mar 09 '26
git repo (github/gitlab/azuredevops/etc)
put everything in there, religiously
move anything that's not in there already to there
1
u/Abn0rm Mar 09 '26
I fixed this today actually, at least for my use case, I had stuff spread all over. I just deployed a brand new gitea server and just started from scratch creating structures and repos that made sense for me.
All notes related was just added in their seperate readme.md files in each repo, it turned out really neat and clean.
1
u/icepyrox Mar 10 '26
I write my scripts in Visual Studio Code. I have installed Git for Windows. Our team has an on premium version of Azure DevOps (ADO).
So I have 3 repos on my computer:
As for documentation and whatnot: I do use comment based help to remember what a script does, but also VSCode supports markdown, so I have .MD files in folders with scripts im working on to make myself notes on what its actually doing.
I think the most common file name repeated all over these repos is Bookmarks.md where I just have lists of bookmarks to code snippets and stackoverflow where im looking up how to approach a script and saving for later since computers get logged out nightly.
1
u/Adeel_ Mar 10 '26
Gitlab or Github
1
u/D4ft_M0nk Mar 10 '26
Git Repo connected to my GitHub, with a special folder for all my Modules so they don’t have to be loaded in from my profile every time I launch a PowerShell session
1
u/Vern_Anderson Mar 10 '26
Back in the day, they used to use Subversion and TortoiseSVN. In case you need an on prem solution!
I have no idea how they are licensed...sorry
1
u/rogueit Mar 11 '26
I do a daily check to see if anything has changed and if it has, I zip up the whole thing and upload to one drive.
1
u/Jamsdavis Mar 11 '26
Bytestash!!
1
u/Salt-n-Pepper-War Mar 12 '26
Why wouldn't you put it all in GitHub? We did, no regrets
1
u/node77 Mar 16 '26
I use a Notion DB just for that.
1
u/Fresh_Put1427 Aug 29 '26
I had a similar issue, I'm not in the tech field but I was using ChatGPT, Claude etc to write scripts to help me automate a lot of my processes but it became unmanageable after awhile. I ended up using AI to build a tool I call NORA to link all my scripts from different directories into one place. It spawned into an automation tool for my business but it still serves the general purpose, a central place for my scripts with commands saved so I'm not digging through text files anymore.
0
u/ThrowRAmy_leg Mar 09 '26
I personally have an excel of all of our runbooks and notepad ++ notes for any logic app projects I’ve made. Helps me backtrack on my work and find out what I did to fix any issues etc.
0
u/danhof1 Mar 10 '26
That scattered scripts problem is exactly why I built the command library in TerminalNexus. You can group commands by project and category, set up multi-step scripts with input prompts for the stuff that changes between runs, and export categories so your help desk team can just click and go.
3
u/[deleted] Mar 09 '26
[removed] — view removed comment