generated from deadlydog/Template.NewGitRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tip: Add tip for how to view random help documentation
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/PowerShellTips/2023-10-21-learn-about-a-random-powershell-cmdlet-or-topic.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
$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. | ||
|
||
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters