Version 0.5.0
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
# Chocolatey-tools Release History
|
# Chocolatey-tools Release History
|
||||||
|
## 0.4.10 - 7/26/2019
|
||||||
|
|
||||||
|
### Added
|
||||||
|
*Get-LatestChocoPackage - retrives latest version of package from community repo.
|
||||||
|
*Add-ChocoIntPackage - Internalizes, installs and pushes a new package to an internal repo.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Put comment-based help in right place in functions.
|
||||||
## 0.4.10 - 7/15/2019
|
## 0.4.10 - 7/15/2019
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
RootModule = 'Chocolatey-tools.psm1'
|
RootModule = 'Chocolatey-tools.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '0.4.10'
|
ModuleVersion = '0.5.0'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|||||||
34
functions/Add-ChocoIntPackage.ps1
Normal file
34
functions/Add-ChocoIntPackage.ps1
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
function Add-ChocoIntPackage {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Internalizes, tests the installation and pushes new Chocolatey packages to a internal repository
|
||||||
|
.EXAMPLE
|
||||||
|
Here I internalize the Firefox and Google Chrome packages from the community repo and push to my internal repo.
|
||||||
|
|
||||||
|
Add-ChocoIntPackage -PackageNames firefox,googlechrome -Path C:\Chocotemp\ -RepositoryURL 'https://myrepo/chocolatey' -ApiKey (Get-Credential)
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
||||||
|
[string[]]$PackageNames,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Path,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$RepositoryURL,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[ValidateNotNull()]
|
||||||
|
[System.Management.Automation.PSCredential]$ApiKey
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
Get-LatestChocoPackage -PackageNames $PackageNames |
|
||||||
|
Invoke-ChocoInternalizePackage -Path $Path -PurgeWorkingDirectory |
|
||||||
|
Where-Object { $_.Result -Like 'Internalize Success' } |
|
||||||
|
Invoke-ChocoUpgradeIntPackage -Path $Path -ErrorAction Stop |
|
||||||
|
Where-Object {$_.Result -eq 'Upgrade Success'} |
|
||||||
|
Push-ChocoIntPackage -Path $Path -ApiKey $Apikey -RepositoryURL $RepositoryURL -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$Error[0] | Select-Object -Property Exception,ScriptStackTrace | Format-list
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
function Get-ChocoOutdatedPackages {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Find outdated packages from a local machine
|
Find outdated packages from a local machine
|
||||||
@@ -13,7 +15,6 @@ curl 7.64.0 7.64.1 false
|
|||||||
GoogleChrome 73.0.3683.103 74.0.3729.131 false
|
GoogleChrome 73.0.3683.103 74.0.3729.131 false
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Get-ChocoOutdatedPackages {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
)
|
)
|
||||||
|
|||||||
34
functions/Get-LatestChocoPackage.ps1
Normal file
34
functions/Get-LatestChocoPackage.ps1
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
function Get-LatestChocoPackage {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Get the latest version of one or more packages from the Chocolatey community repository.
|
||||||
|
.EXAMPLE
|
||||||
|
PS C:\Chocotemp> Get-LatestChocoPackage -PackageName googlechrome,firefox
|
||||||
|
|
||||||
|
Name CurrentVersion Version Pinned
|
||||||
|
---- -------------- ------- ------
|
||||||
|
GoogleChrome 75.0.3770.142 75.0.3770.142 No
|
||||||
|
Firefox 68.0.1 68.0.1 No
|
||||||
|
|
||||||
|
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string[]]$PackageNames
|
||||||
|
)
|
||||||
|
$PackageNames | ForEach-Object {
|
||||||
|
$LatestPackage = (choco list $_ --exact --source=chocolatey -r)
|
||||||
|
if ($LatestPackage){
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Name = $LatestPackage.Split('|')[0]
|
||||||
|
CurrentVersion = 'None'
|
||||||
|
Version = $LatestPackage.Split('|')[1]
|
||||||
|
Pinned = 'No'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Error "Could not find latest version of package $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
function Invoke-BoxStarterRemoteUpgrade {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Uses Install-Boxstarterpackage to install packages remotely. In addition, provides ability to deploy new packages and exclude packages.
|
Uses Install-Boxstarterpackage to install packages remotely. In addition, provides ability to deploy new packages and exclude packages.
|
||||||
@@ -13,7 +15,6 @@
|
|||||||
|
|
||||||
Invoke-BoxStarterRemoteUpgrade -ComputerName winclient2 -Credential $DomainCred -AdditionalPackages curl,git -Parallel -ScriptPath C:\Windows\Temp\BoxstarterUpgrade.txt
|
Invoke-BoxStarterRemoteUpgrade -ComputerName winclient2 -Credential $DomainCred -AdditionalPackages curl,git -Parallel -ScriptPath C:\Windows\Temp\BoxstarterUpgrade.txt
|
||||||
#>
|
#>
|
||||||
function Invoke-BoxStarterRemoteUpgrade {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
function Invoke-ChocoInternalizePackage {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Takes PSobject as input to internalize packages
|
Takes PSobject as input to internalize packages
|
||||||
@@ -14,7 +15,6 @@ 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...
|
GoogleChrome Internalize Success 74.0.3729.131 {C:\Chocotemp\chocolatey-core.extension.1.3.3.nupkg, C:\Chocotemp\Googl...
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Invoke-ChocoInternalizePackage {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
function Invoke-ChocoRemoteUpgrade {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Use PowerShell remoting with to remotely update clients by adding and excluding packages. This function uses
|
Use PowerShell remoting with to remotely update clients by adding and excluding packages. This function uses
|
||||||
@@ -26,7 +28,6 @@ Computer : WINCLIENT
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Another example of how to use this cmdlet
|
Another example of how to use this cmdlet
|
||||||
#>
|
#>
|
||||||
function Invoke-ChocoRemoteUpgrade {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
function Invoke-ChocoUpgradeIntPackage {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Takes PSobject to perform a choco upgrade an each package
|
Takes PSobject to perform a choco upgrade an each package
|
||||||
@@ -14,7 +16,6 @@ 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...
|
GoogleChrome Upgrade Success 74.0.3729.131 {C:\Chocotemp\chocolatey-core.extension.1.3.3.nupkg, C:\Chocotemp\GoogleChr...
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Invoke-ChocoUpgradeIntPackage {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
function Push-ChocoIntPackage {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Short description
|
Short description
|
||||||
@@ -18,7 +20,6 @@ chocolatey-core.extension Push Success 1.3.3 C:\Chocotemp\chocolatey-cor
|
|||||||
GoogleChrome Push Success 74.0.3729.131 C:\Chocotemp\GoogleChrome.74.0.3729.131.nupkg
|
GoogleChrome Push Success 74.0.3729.131 C:\Chocotemp\GoogleChrome.74.0.3729.131.nupkg
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Push-ChocoIntPackage {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
function Test-ChocoUpgradeTrigger {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Tests each package a PSObject to see if it meets an item in -TriggerPackages. If so, it will create
|
Tests each package a PSObject to see if it meets an item in -TriggerPackages. If so, it will create
|
||||||
@@ -17,7 +18,6 @@
|
|||||||
\ Triggered Choco Upgrade Ready
|
\ Triggered Choco Upgrade Ready
|
||||||
PS C:\Chocotemp>
|
PS C:\Chocotemp>
|
||||||
#>
|
#>
|
||||||
function Test-ChocoUpgradeTrigger {
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
[Parameter(Mandatory=$true,ValueFromPipeline=$True)]
|
||||||
|
|||||||
Reference in New Issue
Block a user