Open Liturgist opened 7 months ago
@Liturgist can you repro this with the latest version of Microsoft.PowerShell.PSResourceGet? And if so, can you share the output of gmo "Microsoft.PowerShell.PSResourceGet"
? Thanks!
Can't repro. It's very slow, but it works. PSResourceGet v1.0.5.
# Clean up destination
[System.IO.Directory]::GetDirectories(
('{0}\PowerShell\Modules' -f [System.Environment]::GetFolderPath('MyDocuments'))
).Where{
$_.Split([System.IO.Path]::DirectorySeparatorChar)[-1] -eq 'Az' -or
$_.Split([System.IO.Path]::DirectorySeparatorChar)[-1].StartsWith('Az.','OrdinalIgnoreCase')
}.ForEach{
[System.IO.Directory]::Delete($_,$true)
}
# Install older version first
Install-PSResource -Repository 'PSGallery' -TrustRepository -Name 'Az' -Version '11.6.0' -Scope 'CurrentUser' -Verbose
# Update
Update-PSResource -Repository 'PSGallery' -TrustRepository -Name 'Az' -Scope 'CurrentUser' -Verbose
Close issue?
@anamnavi, Az.* directories are in 'C:\Users\$Env:USERNAME\OneDrive\Documents\PowerShell\Modules'. Different failure message now.
PS C:\src> Update-PSResource Az -Repository PSGallery
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running the Set-PSResourceRepository cmdlet.
Are you sure you want to install the PSresource from 'PSGallery' ?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Update-PSResource: Module 'Az' was not updated because no valid module was found in the module directory.Verify that the module is located in the folder specified by $env: PSModulePath.
PS C:\src> $PSVersionTable.PSVersion.ToString()
7.4.5
PS C:\src> gmo "Microsoft.PowerShell.PSResourceGet"
PS C:\src>
@Liturgist Run it again with -Debug
?
Update-PSResource -Repository 'PSGallery' -TrustRepository -Name 'Az' -Debug
What version of Az do you currently have installed?
Get-Module -ListAvailable -Name 'Az'
# PSResourceGet must be able to detect it too
Get-InstalledPSResource -Name 'Az' -Scope 'CurrentUser'
What version of Microsoft.PowerShell.PSResourceGet
did you use?
Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -PassThru
Microsoft.PowerShell.PSResourceGet
currently does not care about / read the $env:PSModulePath
variable, instead it's hard coded to use MyDocuments
for user context:
Unless you have folder redirection / known folder move enabled in OneDrive, PSResourceGet might not check that OneDrive folder. So what does this return for you?
[System.Environment]::GetFolderPath('MyDocuments')
Prerequisites
Steps to reproduce
I am unable to update the Az module.
Expected behavior
Actual behavior
Error details
Environment data
Version
Script 2.2.5 PowerShellGet Desk
Visuals
No response