mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
demo PowerShellGet repositories
This commit is contained in:
@@ -31,16 +31,25 @@ Uninstall-Script Fabrikam-Script -Verbose
|
||||
|
||||
#endregion
|
||||
|
||||
#region Using PowerShellGet find and install other demos
|
||||
#region Using PowerShellGet find and install modules
|
||||
|
||||
# Value: equivalent of pypi
|
||||
# Look for all the modules we'll be demoing today
|
||||
Find-Module -Tag 'PowerShellCore_Demo'
|
||||
|
||||
# Save module to specified location
|
||||
Save-Module -Tag 'PowerShellCore_Demo' -Path /tmp
|
||||
|
||||
# Pipe this to Install-Module to install them
|
||||
Find-Module -Tag 'PowerShellCore_Demo' | Install-Module -Verbose
|
||||
Get-InstalledModule
|
||||
|
||||
# Update all installed modules
|
||||
Update-Module
|
||||
|
||||
#endregion
|
||||
|
||||
#region Using PowerShellGet with tags
|
||||
|
||||
# Look for all the scripts we'll be demoing today
|
||||
Find-Script -Tag 'PowerShellCore_Demo'
|
||||
@@ -50,3 +59,25 @@ Find-Script -Tag 'PowerShellCore_Demo' | Install-Script -Verbose
|
||||
Get-InstalledScript
|
||||
|
||||
#endregion
|
||||
|
||||
#region Working with PowerShellGet repositories
|
||||
|
||||
# List available PS repositories
|
||||
Get-PSRepository
|
||||
|
||||
# Publish script to the PS Gallery
|
||||
Publish-Script -Path C:\Demo.ps1 -NuGetApiKey 1234 -Repository PSGallery -WhatIf
|
||||
|
||||
# Publish module to PS Gallery
|
||||
Publish-Module -Name Demo -RequiredVersion 0.1 -NuGetApiKey 1234 -Repository PSGallery -WhatIf
|
||||
|
||||
# Register a new private feed
|
||||
Register-PSRepository -Name "myPrivateGallery" –SourceLocation "https://www.myget.org/F/powershellgetdemo/api/v2" -PublishLocation "https://www.myget.org/F/powershellgetdemo/api/v2/Packages" -InstallationPolicy Trusted
|
||||
|
||||
# Change the trust level for a repositories
|
||||
Set-PSRepository -Name "myPrivateGallery" -InstallationPolicy "Untrusted"
|
||||
|
||||
# Remove a private feed
|
||||
Unregister-PSRepository -Name "myPrivateGallery"
|
||||
|
||||
#endregion
|
||||
Reference in New Issue
Block a user