[resolved] PackageManagement\Install-Package : Illegal characters in path

Hey folks
Trying to install UD on a Server 2012 R2, but getting below error. Any ideas?

verbose output

PackageManagement\Install-Package : Illegal characters in path.

At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1375 char:21

+ ...          $null = PackageManagement\Install-Package @PSBoundParameters

1- update your powershellget to latest version from powershell gallery

2- try again Install-Module -Name UniversalDashboard.Community -acceptlicense

if it does not work
manually download module
run gci -path “module path” - Recurse | unblock-file

and you should be good.

1 Like

Thanks for the input, wsl2001

Unfortunately, updating PowerShellGet did not help, getting same error.
The problem with manual install is that I’ve noticed Adam releases new UD version on almost monthly basis, I really don’t want to do this manually every month.
If this becomes an issue, I might consider destroying 2012R2 VM and get 2016 instead, that one’s closer to W10.

edit:
It appears PowerShellGet is not updating properly, that could be the problem. Investigating now

Update-Module -Name PowerShellGet -Force
(Get-Module PowerShellGet).Version.ToString()
1.0.0.1

I have updated PowerShellGet and PackageManagement to latest versions, but I am still getting same exact error. This is insane…

get-module -ListAvailable
Script     1.4.5      PackageManagement
Script     2.2.2      PowerShellGet

Install-Module -Name UniversalDashboard -acceptlicense -force            PackageManagement\Install-Package : Illegal characters in path.
At C:\windows\system32\windowspowershell\v1.0\Modules\PowerShellGet\2.2.2\PSModule.psm1:9683 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exce
   ption
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microso
   ft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Try turning on -Verbose on Install-Package to see if it has any more info.

Hi Adam, here you go:

Install-Module -Name UniversalDashboard -acceptlicense -force -verbose                              VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.       VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.                                        VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='UniversalDashboard'' for  ''.                                                                                                                    VERBOSE: Total package yield:'1' for the specified package 'UniversalDashboard'.
VERBOSE: Performing the operation "Install-Module" on target "Version '2.8.0' of module 'UniversalDashboard'".
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'UniversalDashboard' with version '2.8.0' from the repository
'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='UniversalDashboard'' for
 ''.
VERBOSE: InstallPackage' - name='UniversalDashboard',
version='2.8.0',destination='C:\Users\xxx\AppData\Local\Temp\1617056969'
VERBOSE: DownloadPackage' - name='UniversalDashboard',
version='2.8.0',destination='C:\Users\xxx\AppData\Local\Temp\1617056969\UniversalDashboard.2.8.0\UniversalDashb
oard.2.8.0.nupkg', uri='https://www.powershellgallery.com/api/v2/package/UniversalDashboard/2.8.0'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/UniversalDashboard/2.8.0'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/UniversalDashboard/2.8.0'.
VERBOSE: Completed downloading 'UniversalDashboard'.
VERBOSE: Hash for package 'UniversalDashboard' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='UniversalDashboard',
version='2.8.0',destination='C:\Users\xxx\AppData\Local\Temp\1617056969'
VERBOSE: Validating the 'UniversalDashboard' module contents under
'C:\Users\xxx\AppData\Local\Temp\1617056969\UniversalDashboard.2.8.0' path.
PackageManagement\Install-Package : Illegal characters in path.
At C:\windows\system32\windowspowershell\v1.0\Modules\PowerShellGet\2.2.2\PSModule.psm1:9683 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exce
   ption
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microso
   ft.PowerShell.PackageManagement.Cmdlets.InstallPackage

That is very weird. This only happens with the UD module? You can install other modules just fine?

Unfortunately, yes, only UD is affected. I can install other modules just fine

Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.5      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     2.2.2      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Manifest   0.0        UDTemplate
Script     2.0.5      vim                                 {Invoke-Gvim, igv, gvim, vim}

Can you file an issue on the PowerShellGet repo and see if there is anyone that can help? https://github.com/PowerShell/PowerShellGet/issues

I’m not seeing this behavior on numerous machines so I’m not even sure where to start looking. It sounds like it’s something with the UD module that is conflicting with your machine and PSGet. The PSGet Team might have some good ideas on how to debug this.

Hi Adam
This only happens on Server 2012 R2, I have replicated it on a physical server and freshly installed VM after latest updates and installing .NET 4.8 and PS 5

I can install UD on server 2016 or Windows 10 without any issues. Since this is becoming too much of a hassle, I might just destroy 2012R2 VM and install Server 2016 instead.

After saying above, it finally hit me… it works on 2016 or 10 because they have WMF 5.1 preinstalled. Your documentation specifically requires PowerShell 5.1, so this was purely RTFM issue on my part.

I’ve updated WMF 5.0 to WMF 5.1 by downloading and installing *.msu file from Microsoft

It’s working fine now :slight_smile:

Thanks for help guys

2 Likes