Skip to content

Instantly share code, notes, and snippets.

@CN-CODEGOD
Created March 16, 2025 09:21
Show Gist options
  • Save CN-CODEGOD/f4317bd634bdd5acf42ba5780a22b733 to your computer and use it in GitHub Desktop.
Save CN-CODEGOD/f4317bd634bdd5acf42ba5780a22b733 to your computer and use it in GitHub Desktop.
如何在powershell 上传个人模组
1.register
Register-PSRepository -Name "PSGallery" -SourceLocation "https://www.powershellgallery.com/api/v2"
2.获取API
访问 PowerShell Gallery 网站。https://www.powershellgallery.com/
点击 "Sign in" 并使用 Microsoft 账号登录。
进入 "API Keys" 页面,创建一个新的 API Key(建议权限为 Push-Only 以提高安全性)。
复制 API Key,稍后会用到。
3.在模组中创建psd 包含作者名字,描述,模组名字
New-ModuleManifest -Path .\console.psd1 -Description "console grid using out-consolegridview for series occasion" -Author 'cn_codegod' -ModuleVersion "1.0" -RequiredModules "Microsoft.PowerShell.ConsoleGuiTools"
4.publish your module with apikey
$APIKEY=''
PUblish-Module -Path $Pwd -NuGetApiKey $apikey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment