Kaynağa Gözat

windows/*: add more PowerShell commands (#11612)

* windows/*: add more PowerShell commands

* get-commandL fix typo

* Update install-module.md

Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>

---------

Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Reinhart Previano Koentjoro 1 yıl önce
ebeveyn
işleme
e44fd29d4c

+ 29 - 0
pages/windows/get-command.md

@@ -0,0 +1,29 @@
+# Get-Command
+
+> List and get available commands in the current PowerShell session.
+> This command can only be run through PowerShell.
+> More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-command>.
+
+- List all available PowerShell commands (aliases, cmdlets, functions) in the current computer:
+
+`Get-Command`
+
+- List all available PowerShell commands in the current session:
+
+`Get-Command -ListImported`
+
+- List only PowerShell aliases/cmdlets/functions available in the computer:
+
+`Get-Command -Type {{Alias|Cmdlet|Function}}`
+
+- List only programs or commands available on PATH in the current session:
+
+`Get-Command -Type Application`
+
+- List only PowerShell commands by the module name, e.g. `Microsoft.PowerShell.Utility` for utility-related commands:
+
+`Get-Command -Module {{module}}`
+
+- Get the command information (e.g. version number or module name) by its name:
+
+`Get-Command {{command}}`

+ 12 - 12
pages/windows/get-help.md

@@ -1,28 +1,28 @@
 # Get-Help
 
-> Display help information and documentation for PowerShell commands, aka. cmdlets.
+> Display help information and documentation for PowerShell commands (aliases, cmdlets, and functions).
 > This command can only be run through PowerShell.
 > More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-help>.
 
-- Display general help information for a specific cmdlet:
+- Display general help information for a specific PowerShell command:
 
-`Get-Help {{cmdlet}}`
+`Get-Help {{command}}`
 
-- Display a more detailed documentation for a specific cmdlet:
+- Display a more detailed documentation for a specific PowerShell command:
 
-`Get-Help {{cmdlet}} -Detailed`
+`Get-Help {{command}} -Detailed`
 
-- Display the full technical documentation for a specific cmdlet:
+- Display the full technical documentation for a specific PowerShell command:
 
-`Get-Help {{cmdlet}} -Full`
+`Get-Help {{command}} -Full`
 
-- Print only the documentation for a specific parameter of the cmdlet (use `*` to show all parameters), if available:
+- Print only the documentation for a specific parameter of the PowerShell command (use `*` to show all parameters), if available:
 
-`Get-Help {{cmdlet}} -Parameter {{parameter}}`
+`Get-Help {{command}} -Parameter {{parameter}}`
 
 - Print only the examples of the cmdlet, if available:
 
-`Get-Help {{cmdlet}} -Examples`
+`Get-Help {{command}} -Examples`
 
 - List all available cmdlet help pages:
 
@@ -32,6 +32,6 @@
 
 `Update-Help`
 
-- View an online version of cmdlet documentation in the default web browser:
+- View an online version of PowerShell command documentation in the default web browser:
 
-`Get-Help {{cmdlet}} -Online`
+`Get-Help {{command}} -Online`

+ 13 - 0
pages/windows/get-wuapiversion.md

@@ -0,0 +1,13 @@
+# Get-WUApiVersion
+
+> Get the Windows Update Agent version. Part of external `PSWindowsUpdate` module.
+> This command can only be run under PowerShell.
+> More information: <https://github.com/mgajda83/PSWindowsUpdate>.
+
+- Get the currently-installed Windows Update Agent version:
+
+`Get-WUApiVersion`
+
+- Send the current configuration data via email (SMTP):
+
+`Get-WUApiVersion -SendReport -PSWUSettings @{SmtpServer="{{smtp_server}}"; Port={{smtp_port}} From="{{sender_email}}" To="{{receiver_email}}"}`

+ 25 - 0
pages/windows/get-wuhistory.md

@@ -0,0 +1,25 @@
+# Get-WUHistory
+
+> Get the history of installed updates from Windows Update. Part of external `PSWindowsUpdate` module.
+> This command can only be run under PowerShell.
+> More information: <https://github.com/mgajda83/PSWindowsUpdate>.
+
+- Get list of update history:
+
+`Get-WUHistory`
+
+- List the last 10 installed updates:
+
+`Get-WUHistory -Last {{10}}`
+
+- List all updates installed from a specific date to today:
+
+`Get-WUHistory -MaxDate {{date}}`
+
+- List all updates installed in the past 24 hours:
+
+`Get-WUHistory -MaxDate (Get-Date).AddDays(-1)`
+
+- Send the results via email (SMTP):
+
+`Get-WUHistory -SendReport -PSWUSettings @{SmtpServer="{{smtp_server}}"; Port={{smtp_port}} From="{{sender_email}}" To="{{receiver_email}}"}`

+ 13 - 0
pages/windows/get-wusettings.md

@@ -0,0 +1,13 @@
+# Get-WUSettings
+
+> Get the current Windows Update Agent configuration. Part of external `PSWindowsUpdate` module.
+> This command can only be run under PowerShell.
+> More information: <https://github.com/mgajda83/PSWindowsUpdate>.
+
+- Get the current Windows Update Agent configuration:
+
+`Get-WUSettings`
+
+- Send the current configuration data via email (SMTP):
+
+`Get-WUSettings -SendReport -PSWUSettings @{SmtpServer="{{smtp_server}}"; Port={{smtp_port}} From="{{sender_email}}" To="{{receiver_email}}"}`

+ 36 - 0
pages/windows/install-module.md

@@ -0,0 +1,36 @@
+# Install-Module
+
+> Install PowerShell modules from PowerShell Gallery, NuGet, and other repositories.
+> More information: <https://learn.microsoft.com/powershell/module/powershellget/install-module>.
+
+- Install a module, or update it to the latest available version:
+
+`Install-Module {{module}}`
+
+- Install a module with a specific version:
+
+`Install-Module {{module}} -RequiredVersion {{version}}`
+
+- Install a module no earlier than a specific version:
+
+`Install-Module {{module}} -MinimumVersion {{version}}`
+
+- Specify a range of supported versions (inclusive) of the required module:
+
+`Install-Module {{module}} -MinimumVersion {{minimum_version}} -MaximumVersion {{maximum_version}}`
+
+- Install module from a specific repository:
+
+`Install-Module {{module}} -Repository {{repository}}`
+
+- Install module from specific repositories:
+
+`Install-Module {{module}} -Repository {{repository1 , repository2 , ...}}`
+
+- Install the module for all/current user:
+
+`Install-Module {{module}} -Scope {{AllUsers|CurrentUser}}`
+
+- Perform a dry run to determine which modules will be installed, upgraded, or removed through `Install-Module`:
+
+`Install-Module {{module}} -WhatIf`

+ 13 - 0
pages/windows/pswindowsupdate.md

@@ -0,0 +1,13 @@
+# PSWindowsUpdate
+
+> A PowerShell external module to manage Windows Update.
+> This tool provides multiple commands that all can only be run through PowerShell.
+> More information: <https://github.com/mgajda83/PSWindowsUpdate>.
+
+- Install the module using `Install-Module`:
+
+`Install-Module PSWindowsUpdate`
+
+- List all commands available under the module:
+
+`Get-Command -Module PSWindowsUpdate`