title: PowerShell Publish-Module is already used for a different item on the specified repository
body: <p>I've already published with the <code>Publish-Module</code> many modules but suddenly I get this message only for PSGallery</p>
  
  <pre><code>The specified name '$moduleName' is already used for a different item on the specified repository 'PSGallery'. Run 'Find-Script -Name 
  </code></pre>
  
  <p>$moduleName -Repository PSGallery' to check whether the specified name '$moduleName' is already taken.</p>
  
  <p>where $moduleName is the name of the module. The PowerShell I use is </p>
  
  <pre><code>Publish-Module -Path $path -NuGetApiKey $key -Repository PSGallery -WhatIf
  </code></pre>
  
  <p><code>Find-Module</code> reports that $moduleName is indeed a module.
  On PowerShell gallery it presents the artificat as a module
  Same <code>Publish-Module</code> works for any other PSRepository.</p>
  
  <p>Any ideas anyone?</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>I used Fiddler to compare the data flow between two modules.</p>
  
  <p><strong>Publish-Module</strong> at some point executes this (The name of the module with the problem is ISHDeploy.12.0.0)</p>
  
  <pre><code>https://www.powershellgallery.com/api/v2/items/psscript/FindPackagesById()?id='ISHDeploy.12.0.0'&amp;$skip=0&amp;$top=40  
  </code></pre>
  
  <p>and returns</p>
  
  <pre><code>&lt;id&gt;https://www.powershellgallery.com/api/v2/items/psscript/Packages(Id='ISHDeploy.12.0.0',Version='0.1')&lt;/id&gt;
          &lt;category term="NuGetGallery.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /&gt;
          &lt;link rel="edit" title="V2FeedPackage" href="Packages(Id='ISHDeploy.12.0.0',Version='0.1')" /&gt;
          &lt;title type="text"&gt;ISHDeploy.12.0.0&lt;/title&gt;
          &lt;summary type="text"/&gt;
          &lt;updated&gt;2016-08-01T18:36:38Z&lt;/updated&gt;
          &lt;author&gt;
              &lt;name&gt;SDL plc&lt;/name&gt;
          &lt;/author&gt;
          &lt;link rel="edit-media" title="V2FeedPackage" href="Packages(Id='ISHDeploy.12.0.0',Version='0.1')/$value" /&gt;
          &lt;content type="application/zip" src="https://www.powershellgallery.com/api/v2/package/ISHDeploy.12.0.0/0.1.0" /&gt;
          &lt;m:properties&gt;
              &lt;d:Version&gt;0.1&lt;/d:Version&gt;
              &lt;d:NormalizedVersion&gt;0.1.0&lt;/d:NormalizedVersion&gt;
              &lt;d:Copyright&gt;SDL plc. All rights reserved.&lt;/d:Copyright&gt;
              &lt;d:Created m:type="Edm.DateTime"&gt;2016-06-24T13:11:21.6&lt;/d:Created&gt;
              &lt;d:Dependencies/&gt;
              &lt;d:Description&gt;Deployment automation module for SDL Knowledge Center Content Manager 12.0.0 (LiveContent Architect, Trisoft InfoShare)&lt;/d:Description&gt;
              &lt;d:DownloadCount m:type="Edm.Int32"&gt;33&lt;/d:DownloadCount&gt;
              &lt;d:GalleryDetailsUrl&gt;https://www.powershellgallery.com/packages/ISHDeploy.12.0.0/0.1.0&lt;/d:GalleryDetailsUrl&gt;
              &lt;d:IconUrl m:null="true" /&gt;
              &lt;d:IsLatestVersion m:type="Edm.Boolean"&gt;true&lt;/d:IsLatestVersion&gt;
              &lt;d:IsAbsoluteLatestVersion m:type="Edm.Boolean"&gt;true&lt;/d:IsAbsoluteLatestVersion&gt;
              &lt;d:IsPrerelease m:type="Edm.Boolean"&gt;false&lt;/d:IsPrerelease&gt;
              &lt;d:Language m:null="true" /&gt;
              &lt;d:Published m:type="Edm.DateTime"&gt;2016-06-24T13:11:21.6&lt;/d:Published&gt;
              &lt;d:PackageHash&gt;0BsR7SQjEe7q5XO0IJqMOTS5iySLVYSzUFqHte4Hjng6Fxi+8BaUy3RNqmXs9Q53+QgrddI7e5Lij29kQlLS/g==&lt;/d:PackageHash&gt;
              &lt;d:PackageHashAlgorithm&gt;SHA512&lt;/d:PackageHashAlgorithm&gt;
              &lt;d:PackageSize m:type="Edm.Int64"&gt;2723982&lt;/d:PackageSize&gt;
              &lt;d:ProjectUrl&gt;https://sdl.github.io/ISHDeploy/12.0.0/Index.html&lt;/d:ProjectUrl&gt;
              &lt;d:ReportAbuseUrl&gt;https://www.powershellgallery.com/package/ReportAbuse/ISHDeploy.12.0.0/0.1.0&lt;/d:ReportAbuseUrl&gt;
              &lt;d:ReleaseNotes&gt;https://sdl.github.io/ISHDeploy/12.0.0/CHANGELOG.html&lt;/d:ReleaseNotes&gt;
              &lt;d:RequireLicenseAcceptance m:type="Edm.Boolean"&gt;false&lt;/d:RequireLicenseAcceptance&gt;
              &lt;d:Summary m:null="true" /&gt;
              &lt;d:Tags m:null="true" /&gt;
              &lt;d:Title m:null="true" /&gt;
              &lt;d:VersionDownloadCount m:type="Edm.Int32"&gt;33&lt;/d:VersionDownloadCount&gt;
              &lt;d:MinClientVersion m:null="true" /&gt;
              &lt;d:LastEdited m:type="Edm.DateTime"&gt;2016-06-24T14:14:56.217&lt;/d:LastEdited&gt;
              &lt;d:LicenseUrl m:null="true" /&gt;
              &lt;d:LicenseNames m:null="true" /&gt;
              &lt;d:LicenseReportUrl m:null="true" /&gt;
              &lt;d:Workflows/&gt;
              &lt;d:ItemType&gt;Module&lt;/d:ItemType&gt;
              &lt;d:FileList&gt;ISHDeploy.12.0.0.nuspec|ISHDeploy.12.0.0.dll|ISHDeploy.12.0.0.dll-Help.xml|ISHDeploy.12.0.0.psd1|ISHDeploy.12.0.0.xml|Microsoft.Web.Administration.dll|System.Data.SqlServerCe.dll|amd64\sqlceca40.dll|amd64\sqlcecompact40.dll|amd64\sqlceer40EN.dll|amd64\sqlceme40.dll|amd64\sqlceqp40.dll|amd64\sqlcese40.dll|amd64\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest|amd64\Microsoft.VC90.CRT\msvcr90.dll|amd64\Microsoft.VC90.CRT\README_ENU.txt|x86\sqlceca40.dll|x86\sqlcecompact40.dll|x86\sqlceer40EN.dll|x86\sqlceme40.dll|x86\sqlceqp40.dll|x86\sqlcese40.dll|x86\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest|x86\Microsoft.VC90.CRT\msvcr90.dll|x86\Microsoft.VC90.CRT\README_ENU.txt&lt;/d:FileList&gt;
              &lt;d:Cmdlets&gt;Disable-ISHUITranslationJob Enable-ISHUITranslationJob Disable-ISHUIQualityAssistant Enable-ISHUIQualityAssistant Disable-ISHUIContentEditor Enable-ISHUIContentEditor Disable-ISHExternalPreview Enable-ISHExternalPreview Set-ISHContentEditor Test-ISHContentEditor Get-ISHPackageFolderPath Set-ISHUIEventMonitorTab Move-ISHUIEventMonitorTab Remove-ISHUIEventMonitorTab Remove-ISHIntegrationSTSCertificate Set-ISHIntegrationSTSCertificate Save-ISHIntegrationSTSConfigurationPackage Set-ISHIntegrationSTSWSFederation Set-ISHIntegrationSTSWSTrust Save-ISHIntegrationDBSTSSQLServerConfiguration Clear-ISHDeploymentHistory Get-ISHDeployment Get-ISHDeploymentHistory Undo-ISHDeployment Set-ISHAPIWCFServiceCertificate&lt;/d:Cmdlets&gt;
              &lt;d:Functions/&gt;
              &lt;d:DscResources/&gt;
              &lt;d:RoleCapabilities/&gt;
              &lt;d:GUID&gt;68ae5b26-edc0-453a-a720-ecc99d9b603e&lt;/d:GUID&gt;
              &lt;d:PowerShellVersion&gt;3.0&lt;/d:PowerShellVersion&gt;
              &lt;d:PowerShellHostVersion m:null="true" /&gt;
              &lt;d:DotNetFrameworkVersion&gt;4.5&lt;/d:DotNetFrameworkVersion&gt;
              &lt;d:CLRVersion&gt;4.0&lt;/d:CLRVersion&gt;
              &lt;d:ProcessorArchitecture m:null="true" /&gt;
              &lt;d:CompanyName&gt;SDL plc&lt;/d:CompanyName&gt;
              &lt;d:Owners&gt;SDL&lt;/d:Owners&gt;
          &lt;/m:properties&gt;
      &lt;/entry&gt;
  &lt;/feed&gt; 
  </code></pre>
  
  <p>I compared with another module and I can't find any significant differences that could matter. It looks like something from this output halts the rest of the execution. Something in the xml is interpreted as a script entity although the xml clearly states that  this a module</p>
  
  <pre><code>&lt;d:ItemType&gt;Module&lt;/d:ItemType&gt;
  </code></pre>
  
  <p>The manifest of the module to publish is </p>
  
  <pre><code>#
  # Module manifest for module 'ISHDeploy.12.0.0'
  #
  # Generated by: SDL plc
  #
  # Generated on: 01-Aug-16
  #
  
  @{
  
  # Script module or binary module file associated with this manifest.
  RootModule = 'ISHDeploy.12.0.0'
  
  # Version number of this module.
  ModuleVersion = '0.2'
  
  # ID used to uniquely identify this module
  GUID = '68ae5b26-edc0-453a-a720-ecc99d9b603e'
  
  
  # Author of this module
  Author = 'SDL plc'
  
  # Company or vendor of this module
  CompanyName = 'SDL plc'
  
  # Copyright statement for this module
  Copyright = 'SDL plc. All rights reserved.'
  
  # Description of the functionality provided by this module
  Description = 'Deployment automation module for SDL Knowledge Center  Content Manager 12.0.0 (LiveContent Architect, Trisoft InfoShare)'
  
  
  # Minimum version of the Windows PowerShell engine required by this module
  PowerShellVersion = '3.0'
  
  # Name of the Windows PowerShell host required by this module
  # PowerShellHostName = ''
  
  # Minimum version of the Windows PowerShell host required by this module
  # PowerShellHostVersion = ''
  
  # Minimum version of Microsoft .NET Framework required by this module
  DotNetFrameworkVersion = '4.5'
  
  # Minimum version of the common language runtime (CLR) required by this module
  CLRVersion = '4.0'
  
  # Processor architecture (None, X86, Amd64) required by this module
  # ProcessorArchitecture = ''
  
  # Modules that must be imported into the global environment prior to importing this module
  # RequiredModules = @()
  
  # Assemblies that must be loaded prior to importing this module
  # RequiredAssemblies = @()
  
  # Script files (.ps1) that are run in the caller's environment prior to importing this module.
  # ScriptsToProcess = @()
  
  # Type files (.ps1xml) to be loaded when importing this module
  # TypesToProcess = @()
  
  # Format files (.ps1xml) to be loaded when importing this module
  # FormatsToProcess = @()
  
  # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
  # NestedModules = @()
  
  # Functions to export from this module
  FunctionsToExport = '*'
  
  # Cmdlets to export from this module
  CmdletsToExport = '*'
  
  # Variables to export from this module
  VariablesToExport = '*'
  
  # Aliases to export from this module
  AliasesToExport = '*'
  
  # DSC resources to export from this module
  # DscResourcesToExport = @()
  
  # List of all modules packaged with this module
  # ModuleList = @()
  
  # List of all files packaged with this module
  # FileList = @()
  
  # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
  PrivateData = @{
  
      PSData = @{
  
          # Tags applied to this module. These help with module discovery in online galleries.
          # Tags = @()
  
  
          # A URL to the license for this module.
          # LicenseUri = ''
  
          # A URL to the main website for this project.
          # ProjectUri = ''
  
          # A URL to an icon representing this module.
          # IconUri = ''
  
          # ReleaseNotes of this module
          # ReleaseNotes = ''
  
      } # End of PSData hashtable
  
  } # End of PrivateData hashtable
  
  # HelpInfo URI of this module
  HelpInfoURI = 'https://sdl.github.io/ISHDeploy/12.0.0/'
  
  
  # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
  # DefaultCommandPrefix = ''
  
  }
  </code></pre>
  
  <p>I verified that the GUID is the same just in case it mattered for the gallery</p>
  
  <p><strong>Conclusion</strong>
  I copy the summary from my answer bellow</p>
  
  <p>Summary is that a module in gallery without tags is evaluated also a script and blocks the <code>Publish-Module</code></p>