Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

  1. Once you have installed ProGet using either the GUI or PowerShell script approach, log in to the ProGet application home page using the default admin account until you create a username and password:
  1. From Feeds page, click Create New Feed:
  1. A list of supported feed types is displayed. Choose PowerShell:
  1. Enter a feed name of your choice: (for example, MyPowerShellPackages) and click the Create New PowerShell Feed button:
  1. Review the properties of your new feed:
  1. Open the PowerShell ISE or console, and register your new repository:
      $RepositoryURL = `
"http://localhost:81/nuget/MyPowerShellPackages/"
Register-PSRepository -Name MyPowerShellPackages `
-SourceLocation $RepositoryURL`
-PublishLocation $RepositoryURL `
-InstallationPolicy Trusted
  1. Publish a module you already have installed (Pester, for example):
      Publish-Module -Name Pester -Repository MyPowerShellPackages `
-NuGetApiKey "Admin:Admin"
  1. Download a module from PSGallery, save it to the C:\Foo folder, and publish to your new repository (for example, Carbon):
      Find-Module -Name Carbon -Repository PSGallery 
New-Item -ItemType Directory -Path 'C:\Foo'
Save-Module -Name Carbon -Path C:\foo
Publish-Module -Path C:\Foo\Carbon `
-Repository MyPowerShellPackages `
-NuGetApiKey "Admin:Admin"
  1. Find all the modules available in your newly created and updated repository:
      Find-Module -Repository MyPowerShellPackages