I have been experimenting with PowerShell for a while now and I have come to the conclusion that it is a very powerful tool. I like being able to manipulate various objects in the operating system so that I can automate everyday tasks.
One of the things I do a lot of is search my system for files. Normally I look by name but sometimes I need to search by file extension. So, I thought this would be the perfect candidate for a script.
Now, this blog post will not go into great detail on what this script does. If you want to view it or download it you can find it in my GitHub repo of PowerShell scripts.
Similarly, I will assume you know how to run scripts in PowerShell. If you have never used PowerShell then now is the time to learn! There are lots of tutorials on the web. You can start with the Windows PowerShell User’s Guide.
Instead, this post is about how you can contribute scripts to TechNet on the Microsoft site. If you are unfamiliar with TechNet consider it a portal containing information and technical resources for Microsoft products.
There are two areas on TechNet that you can post to. One is the TechNet Gallery. This space includes scripts as well as resources for all of the current Microsoft operating systems.
Upon reading up on the differences between the two it seemed that in previous years you needed to post a script to both sites individually. However, my experience was that posting to the Script Center Repository replicated it to the TechNet Gallery.
If you want some background on why it is prudent to have your script in both galleries you can check out this article entitled How to Publish your Script to Both the TechNet Gallery and the TechNet Script Center Repository. Author Craig Lussier says that by “having your script listed in both the Gallery and Script Center Repository you can ensure that there are more access points for your contribution for the community at large.”
Before you can begin inserting your script you must have a Microsoft account. You can sign up for one on the TechNet site. This account can be used here and is also the same account you would use on the MSDN forums if you have questions. For those of you who have not been using TechNet or MSDN lately you will also see that Microsoft has added a badging system like StackOverflow’s to your profile. You can see an example on my profile below:
How To Upload
Once you are logged into TechNet you will see an area on the left-hand side entitled “Quick Access.” Under this title there will be an “Upload a contribution” link. Click it to begin the process.
Use the “File upload” section to browse to your PowerShell (*.ps1) or other script file. Then give your contribution a title that describes your script. For mine I am calling it “Get files by extension within a given path (PowerShell).” I added the script type to the header so that it is clear within the search results what type of script it is.
Next, use the “Description” area to provide more information about your contribution. You can add code snippets, screenshots, additional files and even HTML to illustrate your script. To see an excellent example of a description with HTML, images and code snippets check out this highly rated contribution.
For my description I am adding a summary of what the user should expect when they run the script. I am also adding my full PowerShell file using the “Insert Code Section” button on the description toolbar. To do this I just needed to select my script language and then paste my code into the left-hand side. A preview is automatically generated on the right-hand side for me. If you are happy with the preview click the “Insert” button to add paste it in.
The “Summary” is what will be displayed in the search results. You can default to using the initial 280 characters of your description or you can write a new one. The site will raise an error if your description has less than 280 characters though. You will also need to set the language of your description.
Choosing a Category was tricky for me as the script is more of a productivity item. I searched the Script Center Repository for similar scripts to see which category others chose. I eventually went for the Storage category. I then chose the Files sub category.
Tip: To find a category you could always browse through the sub categories first to see if a narrower topic can help define your top-level category.
Now set the “Operating systems” that you have tested the script on. You can then assign tags to the submission so that it is easier to find and categorize. The list is auto-populated so you can type in as many as you need. Again, looking at similar scripts in the repository can help you choose tags that are appropriate.
Under “Options” you can then elect to have the Questions and Answers tab on your contribution. One of the benefits of adding your script to TechNet is that people can comment on it and ask questions. I have also seen commenters provide alternate ways of accomplishing the same tasks which allows you to learn even more.
We do not claim ownership of any Submission unless otherwise agreed to by the parties. However, by providing a Submission, you are irrevocably granting Microsoft and its Affiliates the right to make, use, modify, distribute and otherwise commercialize the Submission in any way and for any purpose (including by granting the general public the right to use your Submissions in accordance with this Agreement, which may change over time).
Finally, if you are happy with the results click “Save and publish.”
How The Script Appears
Clicking “Save and publish” makes the script appear instantly in the TechNet Script Center Repository. Once published the contribution URL can be found under “My contributions” in the “Quick Access” area.
A quick search of both the script name and of my last name in the TechNet Script Center Repository confirms that the script is now live. A similar search in the TechNet Gallery also displays my script.
So, officially my Get files by extension within a given path (PowerShell) script can now be found at https://gallery.technet.microsoft.com/scriptcenter/Get-files-by-extension-9540b197.
One interesting thing to note is that I now have an additional link under the “Quick Access” area called “Browse script requests.” This link lists scripts that were requested by other community members. This will definitely be a great starting point for future PowerShell project ideas.
As you can now see I have a PowerShell script in both GitHub and the TechNet galleries. The whole process was very intuitive and quick. I encourage you to think about contributing your scripts to TechNet.
Please download my script and try to run it on your system. As well, please leave a question or a rating on a TechNet gallery page.
Hopefully you have found this blog post useful. If you have any questions or comments please leave me a message below.