With time, the number of PowerShell scripts I write keeps growing and growing, and I feel it is getting more and more difficult to find what I have done in the past. I won't say that all my scripts are great! Especially when I look at the scripts I wrote back in 2010/2011 or even 2012. I'm really happy to see the evolution as I keep learning about PowerShell. And honestly ... I think it is really fun to update old scripts, and it is always a good topic for a new blog post.
Today I will talk about my scripts directory, how I maintain it, which naming convention I use, what are my bottlenecks, my preferences ...
Naming Convention
Personally I organize my directories this way:<TECHNOLOGY>-<CATEGORY>-<EXPLICIT_TITLE>
For example, you would get those kind of folders for my scripts:
AD-SITE-Find_Missing_subnets
AD-COMPUTER-Windows_Server_2012
VMWARE-HOSTS-Resources_Report
EXCHANGE-MAILBOX-Top_100_user
For my functions I have different standard, I had the prefix FUNCT, so those can be reused in other scripts (Dot Sourcing, mostly).
FUNCT-AD-SITE-Get-Subnets
FUNCT-AD-SITE-Set-Subnets
FUNCT-VMWARE-VM-Enable-CopyPaste
FUNCT-VMWARE-VM-Disable-CopyPaste
Other preferences
- Keep the script in one place! That's why I use SkyDrive (see below), easier to maintain when you access your scripts from different devices/locations.
- I don't like space, I never use space in the name of a folder or a script, always use the underscore "_" or a dash "-" characters.
- Instead of using files, I prefer to use folders for each script or function, especially if I want to keep track of different versions. Also Some scripts might need some XML config file, CSV file input etc... or just because your script is a project of multiple PowerShell script/functions files.
BottleNecks/Missing items
- Versioning/Version Control
- I did not play with any solution yet, it would be great to have tool that can do the tracking job for me
- Collaboration Tool
- I would like something like Google Docs where you see what each people are doing/typing, and obviously a solution that would support PowerShell files...
Note: I would be interested to hear how you guys get your scripts organized, I'm always looking for ways to improve my folders names and structures. Also I did not look into version control solutions yet, if you have tried any let me know.
SkyDrive
I store all my scripts on Skydrive, Windows 8.1 comes with it !Plus, Skydrive allows you to edit your file online! Pure Awesomeness! :-)
The only things missing are: We can't embed the files to another website, No version control unless you use the Pro version, No live collaboration tool.
YES! you can edit your script right into the browser! :-) |
Thanks for Reading! If you have any questions, leave a comment or send me an email at fxcat@lazywinadmin.com. I invite you to follow me on Twitter @lazywinadm / Google+ / LinkedIn You can also follow the LazyWinAdmin Blog on Facebook Page and Google+ Page
Great posts! I've learned a great deal from your blog.
ReplyDeleteI use GitHub and have the repository live in my SkyDrive folder. You get the benefits of version control and having the latest copy of your script available on all your machines.
Thanks John!
DeleteHow do you use Github with Skydrive ? you mean you installed GIT locally on each PC ? http://git-scm.com/
For work in progress I use skydrive as well. When they're completed I upload them to a custom sharepoint list on Office 365 with versioning where I can easily search. I also specify which components/technologies are used in a script. You can take a look here:http://bjornhouben-web.sharepoint.com/Lists/Scripts/Summary.aspx
ReplyDeleteThanks for your comment Bjorn!
DeleteCool stuff, ok you put your scripts on office 365 with the SharePoint online, Sweeet!! :-D
I may just not have seen it, do you plan on updating your lazywinadmin ps script? Last update I see is 2012. I have been adding items to it here and there for my use. Also, do you think you will post a zip of your script folder? Would be a big help.
ReplyDeleteThanks for your reply Joe.
DeleteI'm working on a another version of LazyWinAdmin at the moment... but it takes a lot times. It will be released on this blog.
Unfortunately I cannot share my entire script repo, there are probably some scripts with code I'm not proud of :-)
You can find my public scripts on TechNet here : http://gallery.technet.microsoft.com/site/search?query=Francois-Xavier&f%5B0%5D.Value=Francois-Xavier&f%5B0%5D.Type=SearchText&ac=2
I understand. I have been working on one also. I should have started with great work and thank you.
Delete