Recently I formatted laptop and all the settings for my script environment where gone, I developed lots of PowerShell script using my laptop and use Version control to track changes which is very important, especially when I daily change my codes. Although I solely write my code, still if i require it to be collaborated in future I can maintain some system for versioning, a version control system can allow me to development with my DevOps teams to build and ship better products faster.
I find Visual studio code is best so far for developing my powershell codes, I use Git as version control system. and using git on Visual studio is very easy, it provides GUI way. Git is already installed on my system (https://git-scm.com/download/win). here for example I have built my few small scripts, they are working fine. Now I want a version control so I can move with further development. To proceed with GIT click on Source Control button on the left had side.
This shows me No source control providers registered. I will add one local git as a provider, By clicking very small git icon as shown, shows me where I want to create git related files (version control system). I will select the default folder for this (all my scripts are in same files.)
Once added workspace, As no files are staged on the git system and all files and folders are untracked with U message. Press + on change and type something useful message (ie: First Initial).
The next, I faced error when clicking on commit button. The error was "Make sure you configure your "user.name" and "user.email" in git." or "Git: *** Please tell me who you are", Clicking on open git log, shows Output whats going wrong.
Output shows Git need to configured with global settings and few commands need to be run, To correct this open CMD prompt, by default git is installed under C:\Program Files\Git\bin. cd to the location and run below command.
cd C:\Program Files\Git\bin
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
You can follow same step by watching below video.
Useful articles
Powershell one liner: Create multiple user accounts
Active Directory Powershell: Create bulk users from CSV file
Active Directory Powershell: Aduser A value for the attribute was not in the acceptable range of values
Powershell Active Directory: ADGroup Managedby - Checkbox Manager can update membership list