blog
Update-Module : Module ‘PowershellGet’ was not installed by using Install-Module, so it cannot be updated.
This error usually appears when a machine is using the PowerShellGet version that shipped with Windows rather than a copy that was previously installed from PSGallery. In other words, Update-Module is doing exactly what it is supposed to do: it refuses to update something that was not originally installed with Install-Module.
Update-Module : Module ‘PowershellGet' was not installed by using Install-Module, so it cannot be updated. At line:1 char:1
- Update-Module PowershellGet
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (PowershellGet:String) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : ModuleNotInstalledUsingInstallModuleCmdlet,Update-Module

Why it happens
Older Windows and Windows Server builds often include an inbox version of PowerShellGet. That built-in copy is real and usable, but it is not considered an installed gallery package, so Update-Module will not service it directly.
Working fix
Instead of trying to update the inbox copy, install a newer version side by side from PSGallery:
Install-Module PowerShellGet -Force
If you prefer not to install for all users, use:
Install-Module PowerShellGet -Force -Scope CurrentUser
That installs a newer copy without removing the OS-provided version.

Verify what is available
After installation, restart PowerShell and confirm the newer version is now visible:
Get-Module PowerShellGet -ListAvailable | Sort-Object Version -Descending
Related symptom
One common reason people hit this problem is because they were trying to use Install-Module -AllowPrerelease and the parameter did not exist on their old PowerShellGet build. Once the newer module is installed and the session is restarted, that scenario usually goes away as well.