![Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/733/36700733/b_36700733.jpg)
上QQ阅读APP看书,第一时间看更新
How to do it...
- 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:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/9b1957bc-201d-4f93-8151-f572da178100.png?sign=1739397040-24W9VcJ6K1qXGH3FLHMH7DgDYFlk8BBT-0-322459076129219934714db39815fc48)
- From Feeds page, click Create New Feed:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/9da2dd51-26e0-4d65-a1a7-eb844e7cd383.png?sign=1739397040-up9jCJhaVc6x4MMqUBv34YwGuvNyczIu-0-3a26d80bdb81d2ff4962af794d9cde96)
- A list of supported feed types is displayed. Choose PowerShell:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/0c171621-0925-4810-b984-307e7f196728.png?sign=1739397040-tLfkj03F5NuBeGh8mvL4JAbCqy7An0NJ-0-137d3a7f40a2433d858946a77d060aa4)
- Enter a feed name of your choice: (for example, MyPowerShellPackages) and click the Create New PowerShell Feed button:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/3f4305f9-deb4-4008-9df5-acd528b6c5ed.png?sign=1739397040-2NBHKl2MiCxH5Yi2egqphAW44wo2130d-0-c713107f83e28acff9a8e2cc33c6aa9f)
- Review the properties of your new feed:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/49c21a5f-ef93-42be-b6f5-6dc83be5d863.png?sign=1739397040-9lqiURg9SrOB62ZmvsY6Axur0gJd8FJl-0-b76de06ff86a2a9ca9458d4175ecf5dc)
- 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
- Publish a module you already have installed (Pester, for example):
Publish-Module -Name Pester -Repository MyPowerShellPackages `
-NuGetApiKey "Admin:Admin"
- 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"
- Find all the modules available in your newly created and updated repository:
Find-Module -Repository MyPowerShellPackages