Get Started. It's Free
or sign up with your email address
PowerShell by Mind Map: PowerShell

1. Lesson Four (Write Host)

1.1. 'Write-Host' simply just writes to the screen

1.2. 'Tee-Object' Goes into a path and passes one output to the file and one to the screen

1.3. 'Write-Error" Allows user to write error text to the screen

1.4. 'Write-Warning"

2. PowerShell & Strings

2.1. Commons Functions

2.1.1. "Variable".ToUpper()

2.1.2. "Variable".ToLower()

2.1.3. "Variable".Contains("") will return a boolean

2.1.4. 'Rename-Item'

2.1.5. .Substring()

2.2. Other Examples

2.2.1. "Trimstar" & "IndexOf" & "SubString"

3. Lesson Three (The File System)

3.1. 'cd' is the command for 'set-location'

3.2. 'dir' is the command for 'get-childitem'

3.3. 'md' is the command for 'mkdir' & /or 'new-item -ItemType Directory "" '

3.4. 'remove-item'

3.5. 'copy-item'

4. Get Commands

4.1. Get-Command

4.1.1. 'Get-Command -noun'

4.1.1.1. 'Get-command -noun *Service'

4.1.2. 'Get-Service'

4.1.3. 'Get-Help'

4.1.3.1. 'Get-Help Get "..." -Examples'

4.1.3.2. 'Get-Help Get "..." -Online

4.1.4. 'Get-Process'

4.1.4.1. EX: 'Get-Process -Name MicrosoftEdge

4.1.4.2. Piping EX: get-process -name MicrosoftEdge | Get-Member

4.1.4.3. EX: 'get-process -name MicrosoftEdge | Select-Object *'

4.1.5. 'Get-History'

4.1.6. 'Get-PSDrive'

5. FIRST & Tips

5.1. type 'Start-Transcript'

5.2. Pressing up(arrow key), gives you the last command you used

5.3. PowerShell has Alias such as 'cls'

5.3.1. 'get-alias "..." '

5.3.2. 'get-alias'

5.3.2.1. EX: 'get-alias ?'

5.4. '& "file path" ' will open an application

5.5. Can divide by ' "value"/gb'

5.6. "{0:N0}" -f

5.7. Write-Host

6. Variables

6.1. EX: '$zebra' = Get-Process MicrosoftEdge

6.1.1. $zebra.Name

7. Lesson Two

7.1. Get-PSDrive | ?{$_.Free -gt 1} | %{$Count = 0; Write-Host "";} { $_.Name + ": Used: " + "{0:N2}" -f ($_.Used/1gb) + " Free: " + "{0:N2}" -f ($_.free/1gb) + " Total: " + "{0:N2}" -f (($_.Used/1gb)+($_.Free/1gb)); $Count = $Count + $_.Free;}{Write-Host"";Write-Host "Total Free Space " ("{0:N2}" -f ($Count/1gb)) -backgroundcolor magenta}

7.1.1. Get-PSDrive

7.1.2. Get-PSDrive | Where-Object {$_.free -gt 1}

7.1.2.1. '?' means 'Where-Object'

7.1.2.2. '$_.free' represents the current item in the pipe

7.1.3. Get-PSDrive | Where-Object {$_.free -gt 1} | Select-Object root, used, free

7.1.3.1. 'Select-Object' allows for specific items to be selected

7.1.4. ForEach-Object

7.1.4.1. Get-PSDrive | Where-Object {$_.free -gt 1} | ForEach-Object {"Zebra"}

7.1.4.2. Get-PSDrive | Where-Object {$_.free -gt 1} | ForEach-Object {Write-Host "Free space for" $_.root is $_.free -Foreground Color Red}

7.1.4.3. Get-PSDrive | Where-Object {$_.free -gt 1} | ForEach-Object{$c=0; Write-Host "This step only runs once."}{$c = $c+1;Wri te-host "This section runs once for each object in the pipe." $c}

7.1.4.4. '%' means 'foreach-object'

7.1.5. "{0:N0}" -f 1000000

8. Lesson One