Failed to update Help for the module - powershell

PS C:\WINDOWS\system32> Update-Help
Update-Help : Failed to update Help for the module(s) 'WindowsUpdateProvider'
with UI culture(s) {en-US} : Unable to retrieve the HelpInfo XML file for UI
culture en-US. Make sure the HelpInfoUri property in the module manifest is
valid or check your network connection and then try the command again.
At line:1 char:1
+ Update-Help
+ ~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Update-Help], Exception
+ FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCommand
PS C:\WINDOWS\system32>

Please try the below, sometimes there's no XML document to update.
Update-Help -Verbose -Force -ErrorAction SilentlyContinue
Official link to Microsoft: Link

According to this link
Apparently a problem at Microsoft's end it always happens since sometimes there's no XML document to update, so for the time being use this command:
Update-Help -Verbose -Force -ErrorAction SilentlyContinue

Related

PowerShell PackageManagement - How to uninstall a package provider?

Troubleshooting i tried uninstalling nuget. NuGetProvider-2.8.5.208.dll to be specific.
I have never worked with Power Shell before and am totally lost.
I found this question that helped me find nuget and create a command to delete it.
But I'm unable to follow through.
I did start powershell as administrator.
Here the input:
(Get-PackageProvider|where-object{$_.name -eq "nuget"}).ProviderPath|Remove-Item -force Restart-Computer
The error message:
Remove-Item : The input object cannot be bound to any parameters of the command because the command does not accept pipeline input or the input and its properties do not match any of the parameters that accept pipeline input.
and its properties do not match any of the parameters that accept pipeline input.
line:1 character:70
+ ... _.name -eq "nuget"}).ProviderPath|Remove-Item -force Restart-Computer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (C:\Users\XXX ...GetProvider.dll:String) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.RemoveItemCommand
How can i solve this and successfully uninstall it?
Thanks for your answer!
Still no luck. Here the error:
Remove-Item : The element C:\Users\XXX\AppData\Local\PackageManagement\ProviderAssemblies\nuget\2.8.5.208
\Microsoft.PackageManagement.NuGetProvider.dll cannot be removed: Access to the path "C:\Users\XXX\AppData\Local\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvide
r.dll" denied.
Line:1 Character:44
+ (Get-PackageProvider NuGet).ProviderPath | Remove-Item -Force
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Users\XXX ...GetProvider.dll:FileInfo) [Remove-Item], Unauthoriz
edAccessException
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand

Cannot install psget

I am trying to install psget on windows 10 from powershell in admin mode but I get:
PS C:\Windows\system32> (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1
Invoke-WebRequest : The given path's format is not supported.
At line:42 char:13
+ Invoke-WebRequest -Uri $Url -OutFile $SaveToLocation
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
+ FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Import-Module : The specified module 'C:\Users\myuser\Documents\WindowsPowerShell\Modules C:\Users\myuser\Documents\WindowsPowerShell\Modules\PsGet' was not loaded
because no valid module file was found in any module directory.
At line:105 char:9
+ Import-Module -Name $Destination\PsGet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\myuser\Do...l\Modules\PsGet:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PsGet is installed and ready to use
USAGE:
PS> import-module PsGet
PS> install-module PsUrl
For more details:
get-help install-module
Or visit http://psget.net
PS C:\Windows\system32>
As suggested below PsGet is actually already installed on windows 10. I have then continued with the next step:
and as can be seen it installs successfully (needs to be done running as administrator). After a restart of the powershell console I still don't get any color highlighting though:
Any ideas?
Btw: the folder C:\Users[my-user]\Documents\WindowsPowerShell\Modules is empty:
Um... psget as in PowerShellGet module that I am almost certain comes on Win 10. I believe your error is even telling you that. Where it says PsGet is installed and ready to use.
Looks like the script at http://psget.net/GetPsGet.ps1 tries to decide where to install by querying for #($env:PSModulePath -split ';') and then limit the search for paths under Documents\WindowsPowerShell\Modules.
It appears that in your computer, PSModulePath includes twice the folder C:\Users\myuser\Documents\WindowsPowerShell\Modules, which causes an issue with the installation script.
You can do either one of these two options to solve it:
Remove one instance of C:\Users\myuser\Documents\WindowsPowerShell\Modules from the PSModulePath variable.
Install PsGet manually using the instructions in the official website.

How to install documentation for 7zip4PowerShell

After installing the 7zip4PowerShell module, if I call Get-Help on any of its cmdlets, I get the message
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
-- To download and install Help files for the module that includes this cmdlet, use Update-Help.
If I call update-help by itself, it doesn't change anything.
If I call update-help -Module 7zip4PowerShell, I get the following:
PS C:\windows\system32> update-help -Module 7zip4PowerShell
update-help : Failed to update Help for the module(s) :
'7Zip4Powershell'
The HelpInfoURI https://github.com/thoemmi/7Zip4Powershell does not start with HTTP.
At line:1 char:1
+ update-help -Module 7zip4PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (HelpInfoUri:Uri) [Update-Help], Exception
+ FullyQualifiedErrorId : InvalidHelpInfoUriFormat,Microsoft.PowerShell.Commands.UpdateHelpCommand
What am I doing wrong?

Where is the best place to Add-PSSnapin SqlServerCmdletSnapin* and SqlServerProviderSnapin*?

I created some psm1 files and I put the following lines at the top of every psm1 file,
Set-StrictMode -Version 2
Add-PSSnapin SqlServerCmdletSnapin*
Add-PSSnapin SqlServerProviderSnapin*
However, it got warning of
WARNING: The names of some imported commands from the module 'mymodule' include unapproved verbs that might make them
less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose
parameter. For a list of approved verbs, type Get-Verb.
And it got the following error if import the modules multiple times.
Add-PSSnapin : An item with the same key has already been added.
At line:1 char:1
+ Add-PSSnapin SqlServerCmdletSnapin*
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-PSSnapin], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Add-PSSnapin : An item with the same key has already been added.
At line:2 char:1
+ Add-PSSnapin SqlServerProviderSnapin*
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-PSSnapin], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Or is there a way make these snapins loaded for every users when the system is booted?
The warning simply says that authors of SqlServerCmdletSnapin and SqlServerProviderSnapin used some 'unapproved' names for their functions. But these functions will work just fine, though MS thinks they can be 'less discoverable' (when user search commands like writing "Get-" and pressing Tab-Tab-Tab... from PS console).
So you are right to put them on the top, just add -ErrorAction SilentlyContinue to get rid of the warning:
Add-PSSnapin SqlServerCmdletSnapin* -ErrorAction SilentlyContinue
Add-PSSnapin SqlServerProviderSnapin* -ErrorAction SilentlyContinue
As for loading these snapins for every user, there are several options to do that using profiles. Read Understanding the Six PowerShell Profiles article.

Can't run my own powershell Cmdlet because access to "Templates" folder is denied?

I'm starting out with Powershell, and I'm having a strange error that I can't find much details about with our friend Mr. Google.
And before you ask, yes, I am definitely running Powershell as an Administrator.
I created a simple Cmdlet that counts files of a specified extension in the current directory.
I can build and run installutil fine.
I can see the snap-in when I Call Get-PSSnapin -Registered, and I can add it using Add-PSSnapin
But when I run my cmdlet, I get the following error:
PS C:\work\Enterprise> Get-PSSnapin -Registered
Name : FileCountCmdlet
PSVersion : 2.0
Description : Returns a file count
PS C:\work\> Add-PSSnapin FileCountCmdlet
PS C:\work\> Get-FileCount
Get-FileCount : Access to the path 'C:\Users\{My-User-Name}\Templates' is denied.
At line:1 char:14
+ Get-FileCount <<<<
+ CategoryInfo : NotSpecified: (:) [Get-FileCount], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,FileCount.FileCountCmdlet
Any thoughts or help would be greatly appreciated!
It sounds like you might be running into what this link describes:
Junction Points
http://www.svrops.com/svrops/articles/jpoints.htm
If so, you'll need to update your cmdlet to skip over these junction points.