generated from deadlydog/Template.NewGitRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path2023-10-21-learn-about-a-random-powershell-cmdlet-or-topic.ps1
40 lines (36 loc) · 2.13 KB
/
2023-10-21-learn-about-a-random-powershell-cmdlet-or-topic.ps1
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
$tip = [tiPS.PowerShellTip]::new()
$tip.CreatedDate = [DateTime]::Parse('2023-10-21')
$tip.Title = 'Learn about a random PowerShell cmdlet or topic'
$tip.TipText = @'
The tiPS module (which is bringing you these tips) is a great way to learn PowerShell every day. There are other ways to learn PowerShell every day too. Use the example code to learn about a random PowerShell cmdlet or topic. Try adding it to your daily routine, or even to your PowerShell profile.
'@
$tip.Example = @'
# Show the Help documentation for a random native cmdlet.
Get-Command -Module Microsoft*,Cim*,PS* | Get-Random | Get-Help -ShowWindow
# Show the Help documentation for a random PowerShell About topic.
Get-Random -input (Get-Help about*) | Get-Help -ShowWindow
# Open your PowerShell profile in VS Code so you can add the below code to it
# to automatically see Help documentation each time you start a new PowerShell
# session on Mondays before 10am.
code $Profile
[DateTime] $now = Get-Date
if ($now.DayOfWeek -eq 'Monday' -and $now.Hour -lt 10)
{
Get-Command -Module Microsoft*,Cim*,PS* | Get-Random | Get-Help -ShowWindow
Get-Random -input (Get-Help about*) | Get-Help -ShowWindow
}
'@
$tip.Urls = @(
'https://jdhitsolutions.com/blog/essential-powershell-resources/'
)
$tip.Category = [tiPS.TipCategory]::Other # Community, Editor, Module, NativeCmdlet, Performance, Security, Syntax, Terminal, or Other.
$tip.Author = 'Daniel Schroeder (deadlydog)'
# Community: Social events and community resources. e.g. PowerShell Summit, podcasts, etc.
# Editor: Editor tips and extensions. e.g. VSCode, ISE, etc.
# Module: Modules and module tips. e.g. PSScriptAnalyzer, Pester, etc.
# NativeCmdlet: Native cmdlet tips. e.g. Get-Process, Get-ChildItem, Get-Content, etc.
# Performance: Tips to improve runtime performance. e.g. foreach vs ForEach-Object, ForEach-Object -Parallel, etc.
# Security: Security tips. e.g. ExecutionPolicy, Constrained Language Mode, passwords, etc.
# Syntax: Syntax tips. e.g. splatting, pipeline, etc.
# Terminal: Terminal shortcuts and tips. e.g. PSReadLine, Windows Terminal, ConEmu, etc.
# Other: Tips that don't fit into any of the other categories.