Skip to content

Commit

Permalink
tip: Add tip for how to view random help documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlydog committed Oct 21, 2023
1 parent 470cfb5 commit fd9213a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
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.
10 changes: 10 additions & 0 deletions src/tiPS/PowerShellTips.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,5 +355,15 @@
"https://github.com/PowerShell/GraphicalTools/"
],
"Category": 2
},
{
"CreatedDate": "2023-10-21T00:00:00",
"Title": "Learn about a random PowerShell cmdlet or topic",
"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.",
"Example": "# Show the Help documentation for a random native cmdlet.\r\nGet-Command -Module Microsoft*,Cim*,PS* | Get-Random | Get-Help -ShowWindow\r\n\r\n# Show the Help documentation for a random PowerShell About topic.\r\nGet-Random -input (Get-Help about*) | Get-Help -ShowWindow\r\n\r\n# Open your PowerShell profile in VS Code so you can add the below code to it\r\n# to automatically see Help documentation each time you start a new PowerShell\r\n# session on Mondays before 10am.\r\ncode $Profile\r\n\r\n[DateTime] $now = Get-Date\r\nif ($now.DayOfWeek -eq 'Monday' -and $now.Hour -lt 10)\r\n{\r\n Get-Command -Module Microsoft*,Cim*,PS* | Get-Random | Get-Help -ShowWindow\r\n Get-Random -input (Get-Help about*) | Get-Help -ShowWindow\r\n}",
"Urls": [
"https://jdhitsolutions.com/blog/essential-powershell-resources/"
],
"Category": 8
}
]

0 comments on commit fd9213a

Please sign in to comment.