Skip to content

Commit

Permalink
Added comment-based help
Browse files Browse the repository at this point in the history
  • Loading branch information
dfranciscus committed May 1, 2019
1 parent 0b73f3c commit aa317d5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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/)!
Expand Down
15 changes: 10 additions & 5 deletions functions/Get-ChocoOutdatedPackages.ps1
Original file line number Diff line number Diff line change
@@ -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()]
Expand Down
18 changes: 15 additions & 3 deletions functions/Invoke-BoxStarterRemoteUpgrade.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -12,7 +27,6 @@ function Invoke-BoxStarterRemoteUpgrade {
[switch]$Parallel
)

#Create dynamic upgrade list
Invoke-Command -ArgumentList $AdditionalPackages,$ExcludedPackages,$ScriptPath -ComputerName $ComputerName -ScriptBlock {
param (
$AdditionalPackages,
Expand All @@ -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
}
Expand Down

0 comments on commit aa317d5

Please sign in to comment.