This lab will update your local documentation on your system and give you practice using it. It will also set up permissions for executing scripts and set up a simple profile file.
To find out what version of Powershell you have, click on the start button and start typing powershell. It will automatically find the powershell program for you. Click on Powershell to start a powershell console window. Use the get-host
command to display the host object for the powershell process, and look for the version
property.
get-host
If you do not have Windows Powershell version 5.1, visit the Microsoft docs website and upgrade to version 5.1 of Windows Powershell. We do not use Powershell Core for this course, but if you want to install it, you can without breaking Windows Powershell. See Microsoft docs website for instructions if you want to play with it.
You should already have a github repo for this course with your bash files. Download and install Github Desktop. Run it to login to your Github account, and clone your COMP2101 repo to your Windows machine. Create a new folder named powershell in your cloned repository on your local disk (most likely it is in Documents/Github/COMP2101/). Be sure to keep your repository updated as you work on your scripts, just like we did with bash.
update-help
command in an Administrator Powershell window (started with right-click and Run As Administrator) to install the complete help pages on your PC
update-help -ea silentlycontinue
help about_
help get-
help get-date
help get-host
help clear-host
help get-date
help -detailed get-date
help -examples get-date
help -full get-date
help -online get-date
show-command
get-date
command with tab completion to see all available parameters-Full
parameter to see what additional help is available.get-date
command to show the date with the data set to your birthdateget-executionpolicy
command to see your current execution policies
get-executionpolicy -list
helloworld.ps1
file described in the presentation in your scripts folder (the one you cloned from Github if you are using Github)helloworld.ps1
script as a command
./helloworld.ps1
set-executionpolicy
command to change your execution policy to the Microsoft-recommended policy
set-executionpolicy remotesigned
get-executionpolicy
command to see what changed
get-executionpolicy -list
helloworld.ps1
script
./helloworld.ps1
'$env:path += ";$home/documents/github/comp2101/powershell"' >> $profile
helloworld.ps1
$env:path
This lab prepares you for the next lab and builds the environment for lab 5 which is the only powershell lab that is marked.