In this article
Ever created a PowerShell script and wanted to share it? What better place than the PowerShell Gallery itself!
Let’s go through how I listed my own PowerShell script on PSGallery.
Create an API key
- Go to https://www.powershellgallery.com/ and sign in or sign up.
- Go to API Keys to create an API key you’ll use later.

- Click Create and set Key Name = script_name and Glob Pattern = *.

Add script metadata
- Now I have my script ready. However, before uploading it, I must add some metadata to it, like Author, Description and Version.
- For that, I used the
New-ScriptFileInfocmdlet. I set the values as per my needs and ran it in the PowerShell console.
$Parms = @{
Path = "C:\Scripts\scriptInfo.ps1"
Version = "2.1.0"
Author = "Mayank Goyal"
Description = "This script converts vRO Package directly into JSDoc website by connecting to vRO. Requires nodejs and jsdoc module installed. Create new files *.html & *.js directly from vRO with JSDoc annotation. It consumes a package name which should exist in vRO with all the Actions you want to document and creates .js files with JSDoc Annotations."
ProjectUri = "https://github.com/imtrinity94/vRODoc"
}
New-ScriptFileInfo @Parms
Get-Content -Path C:\Scripts\scriptInfo.ps1
- This creates a new file,
C:\Users\mayank.goyal1\Downloads\scriptInfo.ps1. Opening it shows this content:
<#PSScriptInfo
.VERSION 2.1.0
.GUID 7202df73-3b8c-4616-adeb-b6d9b97a63c7
.AUTHOR Mayank Goyal
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI https://github.com/imtrinity94/vRODoc
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
<#
.DESCRIPTION
This script converts vRO Package directly into JSDoc website by connecting to vRO. Requires nodejs and jsdoc module installed. Create new files *.html & *.js directly from vRO with JSDoc annotation. It consumes a package name which should exist in vRO with all the Actions you want to document and creates .js files with JSDoc Annotations.
#>
- Copy this file’s content and put it on top of your original script.

Publish the script
- Now it’s time to publish the script. Use the
Publish-Scriptcmdlet with the file path and the API key you created earlier.
Publish-Script -Path "C:\Scripts\vRODoc.ps1" -NuGetApiKey "<your-api-key>" -Repository PSGallery
- This should have worked, but it didn’t. I got this error no matter where I ran it from:
Failed to publish script ‘vRODoc’: ‘The underlying connection was closed: An unexpected error occurred on a send.
Fix the connection error
- The first possible cause is that the system uses TLS 1.1 instead of TLS 1.2. To fix this, run the following command:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
The second possible cause is an outdated PowerShellGet module. To fix this, I ran the following command:
Install-Module PowerShellGet -Force -AllowClobber -Scope CurrentUser
- Restart the PowerShell terminal and run
Publish-Scriptagain. This time it worked.

BINGO! It’s published for anyone to use.

Download
- Source code on GitHub: github.com/imtrinity94/vRODoc
- PowerShell Gallery: powershellgallery.com/packages/vRODoc
- Install it directly with
Install-Script -Name vRODoc
Update (Nov 2026)
The PowerShell Gallery now requires TLS 1.2, so the connection fix above still applies on older systems. On newer PowerShell versions, you can also publish with Publish-PSResource from the PSResourceGet module, which replaces PowerShellGet.
Discover more from Cloud Blogger
Subscribe to get the latest posts sent to your email.
Enjoyed this post?
Was this helpful?





























Leave a Reply