added more help docs

This commit is contained in:
Dan Franciscus
2019-05-01 13:15:06 -07:00
parent aa317d548d
commit 47cabb8ab7
4 changed files with 51 additions and 20 deletions

View File

@@ -1,12 +1,18 @@
<# <#
.SYNOPSIS .SYNOPSIS
Short description Takes PSobject as input to internalize packages
.DESCRIPTION .DESCRIPTION
Long description Long description
.EXAMPLE .EXAMPLE
Example of how to use this cmdlet S C:\> $Outdatedpkgs = Get-ChocoOutdatedPackages
.EXAMPLE PS C:\> Invoke-ChocoInternalizePackage -PackageNames $Outdatedpkgs -Path $Path `
Another example of how to use this cmdlet -PurgeWorkingDirectory | Where-Object { $_.Result -Like 'Internalize Success' }
Name Result Version NuGetpkgs
---- ------ ------- ---------
curl Internalize Success 7.64.1 C:\Chocotemp\curl.7.64.1.nupkg
GoogleChrome Internalize Success 74.0.3729.131 {C:\Chocotemp\chocolatey-core.extension.1.3.3.nupkg, C:\Chocotemp\Googl...
#> #>
function Invoke-ChocoInternalizePackage { function Invoke-ChocoInternalizePackage {
[CmdletBinding()] [CmdletBinding()]

View File

@@ -1,12 +1,18 @@
<# <#
.SYNOPSIS .SYNOPSIS
Short description Takes PSobject to perform a choco upgrade an each package
.DESCRIPTION
Long description
.EXAMPLE .EXAMPLE
Example of how to use this cmdlet PS C:\> $intpkgs = Invoke-ChocoInternalizePackage -PackageNames $Outdatedpkgs -Path $Path `
.EXAMPLE -PurgeWorkingDirectory | Where-Object { $_.Result -Like 'Internalize Success' }
Another example of how to use this cmdlet
PS C:\Chocotemp> Invoke-ChocoUpgradeIntPackage -PackageNames $intpkgs -Path $Path |
Where-Object {$_.Result -eq 'Upgrade Success'}
Name Result Version NuGetpkgs
---- ------ ------- ---------
curl Upgrade Success 7.64.1 C:\Chocotemp\curl.7.64.1.nupkg
GoogleChrome Upgrade Success 74.0.3729.131 {C:\Chocotemp\chocolatey-core.extension.1.3.3.nupkg, C:\Chocotemp\GoogleChr...
#> #>
function Invoke-ChocoUpgradeIntPackage { function Invoke-ChocoUpgradeIntPackage {
[CmdletBinding()] [CmdletBinding()]

View File

@@ -4,9 +4,19 @@
.DESCRIPTION .DESCRIPTION
Long description Long description
.EXAMPLE .EXAMPLE
Example of how to use this cmdlet PS C:\Chocotemp> $Upgradepkgs = Invoke-ChocoUpgradeIntPackage -PackageNames $intpkgs -Path $Path |
.EXAMPLE Where-Object {$_.Result -eq 'Upgrade Success'}
Another example of how to use this cmdlet
PS C:\Chocotemp> Push-ChocoIntPackage -PackageNames $Upgradepkgs -Path $Path `
-ApiKey $Api -RepositoryURL $LocalRepo |
Where-Object {$_.Result -like 'Push Success'}
Name Result Version NuGetPackage
---- ------ ------- ------------
curl Push Success 7.64.1 C:\Chocotemp\curl.7.64.1.nupkg
chocolatey-core.extension Push Success 1.3.3 C:\Chocotemp\chocolatey-core.extension.1.3.3.nupkgpkg
GoogleChrome Push Success 74.0.3729.131 C:\Chocotemp\GoogleChrome.74.0.3729.131.nupkg
#> #>
function Push-ChocoIntPackage { function Push-ChocoIntPackage {
[CmdletBinding()] [CmdletBinding()]

View File

@@ -1,12 +1,21 @@
<# <#
.SYNOPSIS .SYNOPSIS
Short description Tests each package a PSObject to see if it meets an item in -TriggerPackages. If so, it will create
.DESCRIPTION a scheduled task on the local machine. Use case would be a scheduled job for upgrading Chocolatey clients.
Long description
.EXAMPLE .EXAMPLE
Example of how to use this cmdlet Here we pipe all of the internalizing commands together with Test-Trigger.
.EXAMPLE
Another example of how to use this cmdlet PS C:\Chocotemp> Get-ChocoOutdatedPackages |
Invoke-ChocoInternalizePackage -Path $Path -PurgeWorkingDirectory | Where-Object { $_.Result -Like 'Internalize Success' } |
Invoke-ChocoUpgradeIntPackage -Path $Path | Where-Object {$_.Result -eq 'Upgrade Success'} |
Push-ChocoIntPackage -Path $Path -ApiKey $Api -RepositoryURL $LocalRepo |
Test-ChocoUpgradeTrigger -TriggerPackages 'googlechrome' -UpgradeScriptPath c:\test.ps1 -TriggeredTime '12 PM' -Credential $DomainCred
Creating scheduled task for GoogleChrome
TaskPath TaskName State
-------- -------- -----
\ Triggered Choco Upgrade Ready
PS C:\Chocotemp>
#> #>
function Test-ChocoUpgradeTrigger { function Test-ChocoUpgradeTrigger {
[CmdletBinding()] [CmdletBinding()]
@@ -25,7 +34,7 @@
process { process {
foreach ($Package in $PackageNames){ foreach ($Package in $PackageNames){
if ($TriggerPackages -contains $Package.Name){ if ($TriggerPackages -contains $Package.Name){
Write-Output "Creating scheduled task for $($Package.Name)" Write-Output "Creating scheduled task because $($Package.Name) is a triggered package"
Disable-ScheduledTask -TaskName 'Triggered Choco Upgrade' | Unregister-ScheduledTask -Confirm:$False Disable-ScheduledTask -TaskName 'Triggered Choco Upgrade' | Unregister-ScheduledTask -Confirm:$False
$Time = New-ScheduledTaskTrigger -At $TriggeredTime -Once $Time = New-ScheduledTaskTrigger -At $TriggeredTime -Once
$PS = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-file $UpgradeScriptPath" $PS = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-file $UpgradeScriptPath"