From aa317d548d9dee11ca28551021f379c7c842a00b Mon Sep 17 00:00:00 2001 From: Dan Franciscus Date: Wed, 1 May 2019 12:31:21 -0700 Subject: [PATCH] Added comment-based help --- README.MD | 3 +++ functions/Get-ChocoOutdatedPackages.ps1 | 15 ++++++++++----- functions/Invoke-BoxStarterRemoteUpgrade.ps1 | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.MD b/README.MD index 0f4ad5e..1620950 100644 --- a/README.MD +++ b/README.MD @@ -4,8 +4,11 @@ PowerShell module for managing Chocolatey internalizing and remote upgrading of client packages + Authored by Dan Franciscus +## Examples - https://github.com/dfranciscus/Chocolatey-tools/tree/master/Examples + ## Installing The easiest way to get Chocolatey-tools is using the [PowerShell Gallery](https://powershellgallery.com/packages/Chocolatey-tools/)! diff --git a/functions/Get-ChocoOutdatedPackages.ps1 b/functions/Get-ChocoOutdatedPackages.ps1 index 80a6d87..006a2fd 100644 --- a/functions/Get-ChocoOutdatedPackages.ps1 +++ b/functions/Get-ChocoOutdatedPackages.ps1 @@ -1,12 +1,17 @@ <# .SYNOPSIS - Short description + Find outdated packages from a local machine .DESCRIPTION - Long description + Wrapper around choco outdated -r. Ignores pinned and unfound packages from sources .EXAMPLE - Example of how to use this cmdlet -.EXAMPLE - Another example of how to use this cmdlet +PS C:\> Get-ChocoOutdatedPackages + +Name CurrentVersion Version Pinned +---- -------------- ------- ------ +chocolatey.extension 2.0.1 2.0.2 false +curl 7.64.0 7.64.1 false +GoogleChrome 73.0.3683.103 74.0.3729.131 false + #> function Get-ChocoOutdatedPackages { [CmdletBinding()] diff --git a/functions/Invoke-BoxStarterRemoteUpgrade.ps1 b/functions/Invoke-BoxStarterRemoteUpgrade.ps1 index 4d4b5d1..7cc9b0f 100644 --- a/functions/Invoke-BoxStarterRemoteUpgrade.ps1 +++ b/functions/Invoke-BoxStarterRemoteUpgrade.ps1 @@ -1,3 +1,18 @@ +<# +.SYNOPSIS + Uses Install-Boxstarterpackage to install packages remotely. In addition, provides ability to deploy new packages and exclude packages. +.DESCRIPTION + Long description +.EXAMPLE + Here, we upgrade any out of date packages on winclient2, push out curl and git packages and exclude jre8 from updating. + Each of these commands is created dynamically at runtime on a text file on the local machine called Boxstarterupgrade.txt + + Invoke-BoxStarterRemoteUpgrade -ComputerName winclient2 -Credential $DomainCred -AdditionalPackages curl,git -ExcludedPackages jre8 -ScriptPath C:\Windows\Temp\BoxstarterUpgrade.txt +.EXAMPLE + Here we use the -Parallel switch so that each remote machine is processed at the same time. + + Invoke-BoxStarterRemoteUpgrade -ComputerName winclient2 -Credential $DomainCred -AdditionalPackages curl,git -Parallel -ScriptPath C:\Windows\Temp\BoxstarterUpgrade.txt +#> function Invoke-BoxStarterRemoteUpgrade { [CmdletBinding()] param( @@ -12,7 +27,6 @@ function Invoke-BoxStarterRemoteUpgrade { [switch]$Parallel ) - #Create dynamic upgrade list Invoke-Command -ArgumentList $AdditionalPackages,$ExcludedPackages,$ScriptPath -ComputerName $ComputerName -ScriptBlock { param ( $AdditionalPackages, @@ -39,12 +53,10 @@ function Invoke-BoxStarterRemoteUpgrade { Add-Content $ScriptPath -Value "choco upgrade $_ -r -y --timeout=600" } } - #Upgrade computers with Boxstarter if (!$Parallel){ Install-BoxstarterPackage -ComputerName $ComputerName -PackageName $ScriptPath -DelegateChocoSources } else { - #Upgrade computers in parallel with Boxstarter $ComputerName | ForEach-Object { start-process -RedirectStandardOutput C:\Windows\Temp\$_.txt -FilePath powershell -ArgumentList "-windowstyle hidden Install-BoxstarterPackage -ComputerName $_ -PackageName $ScriptPath" -PassThru }