Primitive Datatype Activity

Task 1

Use “Get-Help” to find out more information about 5 cmdlets.

Get-help Get-command

Get-help Set-ExecutionPolicy

Get-help ConvertTo-HTML

Get-help Get-EventLog

Get-help Get-Process

Task 2

Use “Get-Help” with the “–Example” parameter for the 5 cmdlets you discovered more about in task 1.

Get-help -name Get-command -Examples

Get-help -name Set-ExecutionPolicy -Examples

Get-help -name ConvertTo-HTML -Examples

Get-help -name Get-EventLog -Examples

Get-help -name Get-Process -Examples

Task 3

Create a new text file named “TestFile.txt” under C:\Maximo\PowerShell\Workshop1%USERNAME%

New-Item TestFile.txt

Task 4

Populate the text file you created in task 3 with all three datatypes we’ve covered: “Boolean”, “String” and “Int”

Add-Content TestFile.txt -value True

Add-Content TestFile.txt -value "Hello world!"

Add-Content TestFile.txt -value 10

Task 5

Read from the text file and use “Get-Member” to find the datatype returned

Get-Content -path TestFile.txt | Get-member

Task 6

Overwrite all data within the text file that you created in task 3.

Set-Content -Path TestFile.txt -Value "Booooo"

Task 7

Format the data returned by a cmdlet into a list

Get-Service | Format-list

Task 8

Pipe “Get-Command” into “Out-GridView”

Get-Command | Out-GridView

Task 9

Pipe the 5 cmdlets you discovered in task 1 into “Out-GridView”

Get-command | Out-GridView

Set-ExecutionPolicy | Out-GridView

ConvertTo-HTML | Out-GridView

Get-EventLog | Out-GridView

Get-Process | Out-GridView

Task 10

Find the official PowerShell documentation library from Microsoft

https://docs.microsoft.com/es-es/powershell/