/images/avatar.png

Kamil Procyszyn

PowerShell for IT Professionals [#8] – Manage everything with PowerShell

Exercises Can you uninstall module that was installed with Install-Module? Confirm your answer with Get-Module -ListAvaiable Can you update the installed module? Perhaps, you’d like to install version 1.0.0.0 of SNMP module, how can you force Install-Module to do so? Install-Module error If you encounter the issue with downloading modules, run this commandlet as a temporary workaround (it must be applied every time the shell is restarted):

PowerShell for IT Professionals [#7] – Formatting output

Exercises Send output of any commandlet, e.g. get service to Printer Lesson notes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 # So far, we've been using default PowerShell behaviour for formatting output # Although in the last lesson we did filtering data with Where-Object and Select-Object # We didn't really focus on how data is presented on the screen.

PowerShell for IT Professionals [#6] – Filtering output

Exercises List all services that are stopped List all service that are stopped and they name begins with W Display only the Display Name of services that stopped and their name begins with W Lesson notes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ### Filtering # Some commands accept wild cards in the search or have a filter parameter Get-Service -Name w*,b* #But there's more universal method, based on property names Get-Service | Where-Object -Filter {$_.

PowerShell for IT Professionals [#5] – Providers

Exercises Create a folder in root of C: with the name of PowerShell Create a file inside the folder with the name of your choice and no content Retrieve all items from Env: drive Check the version of Notepad.exe in Windows directory Discover current Windows build version by registry property: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion Notes from the lesson 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 # Provider allows to access some data storage (e.

PowerShell for IT Professionals [#4] – Pipeline

Exercises There’s one particular command that allows you output anything from shell to file, find that command and use with any commands like Get-Service or Get-Process. Does it behave differently than Export-CSV? Programs often use CSV but don’t use comma for delimiter – try to exporting to CSV but change the delimiter Can you print directly from shell? See if there are any commands available and if so, print some Event Logs!

PowerShell for IT Professionals [#3] – Running Commands

Exercises Display a list of all services that start with the letter W Display all processes (you might need to use Help to discover the right command. Remember the noun might be singular). Open Notepad (you can simply punch in notepad in the shell) Display only processes that have a name “Notepad” Once you can there’s only one instance of Notepad running, close it with PowerShell!