I’m trying to use ImportExcel for the first time.
this is in the first few lines of my script:
using namespace system.collections.generic
Add-Type -AssemblyName System.Data.OracleClient
Install-Module -Name ImportExcel -Scope CurrentUser -Force #this was just added...gives the following error
error from Install-Module line:
PackageManagement\Install-Package : Unable to find module providers (PowerShellGet).
this is my new function below that:
Function Process_ErrorDescMap{
[cmdletbinding()]
Param ([string]$errorCodeListFilePath)
Process
{
# import excel file and show in gridview (make sure file exists!)
Import-Excel -Path $errorCodeListFilePath | Out-GridView
$errorCodeList = Import-Excel -Path errorCodeListFilePath #| Where-Object 'Month Number' -eq 12 | Group-Object -Property Country -NoElement | Sort-Object -Property Count -Descending
Break ###############################################################
return $errorCodeList #list of error codes
} #end Process
}# End of Function Process_ErrorDescMap
This is my main code area below that…
$deviceErrDescMap = Process_ErrorDescMap -errorCodeListFilePath $errorCodeListFile
#plan is to filter output further like commented out part in function $errorCodeList line
So what am I doing wrong with this Install-Package? I hope I can do it at the top of my script (running in vs code), and not a command line thing. I’d hate to think that everyone that runs this needs to do something at the command line.
I’m looking at these examples:
Update:
I’m trying this:
Find-Module -Name PowerShellGet | Install-Module -Scope CurrentUser -Force
Which gives error:
PackageManagement\Find-Package : Unable to find module providers (PowerShellGet).
I saw unable to find module
It seems like the article is saying to delete the OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement folder. Will that uninstall other things I’ve installed and cause other issues? I’m not sure if I’m using Find-Module/Install-Module incorrectly, and that’s causing the error, or something else I need to fix.