Loading...

Backup your TechNet Gallery contributions and migrate them to GitHub with PowerShell


In this post I will share a script I created that allows you to backup all your Technet Gallery contributions on your computer and then migrate them to your GitHub (if needed).

Context
See my post about the first version here.
As you probably may know Microsoft plans to retire the Technet Gallery on June 2020.
In my case I have 51 contributions to backup and migrate to another site (in my case I choosed GitHub).
That's why I decided to create an automate way to backup my contibutions.

Get the script


What's new ?
- In this version I add a parameter -MigrateToGitHub that allows you to backup first your contribs then upload them on your GitHub.
- I also added a write-progress in the powershell prompt that allows you to know the progression.


What does the script ?
1. The script will analyze the profile of the person you have typed.
2. It will create one folder per contribution in the backup folder you chose.
3. In each contribution folder a Summary.txt file will be created with the description of the post.
4. In each contribution folder, if a file has been uploaded, it will be downloaded here.
5. If you choose to migrate to GitHub it will proceed as below then.
6. Connect to your GitHub
7. Create one repository for each contribution
8. Upload files that have been saved to the appropriate GitHub repo

GitHub connexion from the script
In order to migrate your contributions to GitHub, the script will need a token.
1. You can create it quickly and easily from this link.
2. Select what you want and click on Generate token
3. Note this token, it will be prompted by the script

Files that can be migrated to GitHub
For now I tested with the following files extention: zip, rar, pdf, docx, ps1, vbs, exe

How works the script ?
1. Type the name of the user, in my case I typed mine
2. Type a path where to backup your contributions
3. If you want to migrate them on GitHub add parameter -MigrateToGitHub
4. Type the GitHub token generated previously
5. The script will proceed as below for each contribution

6. See below an overview of my backup

7. See below my GitHub after the process


How to use it ?
1. Run the file Backup_TechnetGallery_Contribs.ps1
2. This will ask for the user for who you want to backup contributions
3. Type the path where to backup contribs
4. You can add parameter -User_Name with the user name to the PS1, as below:
5. If the user has not been found, it may be because of special characters in the profile name
6. In this case you can add the parameter -Profile_Link an use the user profile link. 
7. For instance let's use the Maurice Daly profile.
8. Go to Maurice technet contibs and copy the link in the address bar, as below:
9. The link to copy is the below one:
9. Add it to the parameter, as below:
10. If you want to migrate contrib on GitHub add parameter -MigrateToGitHub, as below:
11. A token will be asked

What about the GitHub migration ?
As mentioned previously the migration to GitHub works in two steps:
- Generate a token and type it in the script
- Add parameter MigrateToHithub

Then the script will proceed as below for each contribution:
- Create a repo for the contribution
- Create a Readme.md with the summary of the contrib
- Add the summary in the Repo description
- Upload files from the contrib to the repo
technet retirement 1445829048712390069

Publier un commentaire

Accueil item

Award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR

Stats