added more help docs
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Short description
|
||||
Takes PSobject as input to internalize packages
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
S C:\> $Outdatedpkgs = Get-ChocoOutdatedPackages
|
||||
PS C:\> Invoke-ChocoInternalizePackage -PackageNames $Outdatedpkgs -Path $Path `
|
||||
-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 {
|
||||
[CmdletBinding()]
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Short description
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
Takes PSobject to perform a choco upgrade an each package
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
PS C:\> $intpkgs = Invoke-ChocoInternalizePackage -PackageNames $Outdatedpkgs -Path $Path `
|
||||
-PurgeWorkingDirectory | Where-Object { $_.Result -Like 'Internalize Success' }
|
||||
|
||||
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 {
|
||||
[CmdletBinding()]
|
||||
|
||||
@@ -4,9 +4,19 @@
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
PS C:\Chocotemp> $Upgradepkgs = Invoke-ChocoUpgradeIntPackage -PackageNames $intpkgs -Path $Path |
|
||||
Where-Object {$_.Result -eq 'Upgrade Success'}
|
||||
|
||||
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 {
|
||||
[CmdletBinding()]
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Short description
|
||||
.DESCRIPTION
|
||||
Long description
|
||||
Tests each package a PSObject to see if it meets an item in -TriggerPackages. If so, it will create
|
||||
a scheduled task on the local machine. Use case would be a scheduled job for upgrading Chocolatey clients.
|
||||
.EXAMPLE
|
||||
Example of how to use this cmdlet
|
||||
.EXAMPLE
|
||||
Another example of how to use this cmdlet
|
||||
Here we pipe all of the internalizing commands together with Test-Trigger.
|
||||
|
||||
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 {
|
||||
[CmdletBinding()]
|
||||
@@ -25,7 +34,7 @@
|
||||
process {
|
||||
foreach ($Package in $PackageNames){
|
||||
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
|
||||
$Time = New-ScheduledTaskTrigger -At $TriggeredTime -Once
|
||||
$PS = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-file $UpgradeScriptPath"
|
||||
|
||||
Reference in New Issue
Block a user