Why have a script repository you say?
Well over the years I’ve had scripts in so many folders only to forget what lies where, using which file, you get the picture.
I’ll let you in on a lil’ secret… It all started when I categorized my digital music library by year – genre – artist. Well it would seem it’s a tick in the Family. My little sister has her library sorted by genre and then alphabetized! So yeah, I guess I got off easy :p
But having your repository is helpful. PowerShell ISE is my goto editor. I’ve set my default location to c:\scripts. That’s the starting point of anything and everything. Ok so what’s the advantage? Well let’s say i need open op a csv file, I’ll just head to my subfolder $pwd\sources\csv. $pwd is one of those default parameters that’s readily available. So what else in sources? Well there’s a xml, txt and xlsx folder as well. So if I need a xml file, I’ll just head on to $pwd\sources\xml
Did I generate a logFile? No problem! $pwd\log it is (Incidentally, I’ll be doing a blog on logFile names soon…) Is it temporary? $pwd\temp
Last but not least the ps1 folder. Once you get to scripting you’re gonna end up with tons of stuff. Some were just to try out, others you’ll keep around just in case (Be sure to give it a name you can quickly identify what its main purpose is, I have some pointers on that as well) So if there’s a certain category your scripting, then why not gather all those scripts together.
I have a subfolder dsa in $pwd\ps1 for all my Active Directory User & Computer scripts. dssite for Sites & Services, gpmc for group policies, you get the idea. It may seem like a lot of hassle but it’s well worth it.
Oh btw I also have a vbs, cmd, export, log, screenshots, subfolders in c:\scripts.
If I need to change or copy to another folder, all I need to do is change the parent folder and I’m good to go!
I haven’t quite figure out posting scripts yet. But once I’ve figured it out I’ll be sure to post it.
So what are thoughts on keeping a script repository? You’re welcome to share!