Corrupt PackageManager? Unable to find module providers (PowerShellGet) - windows

This is a common error that is not solved by the common solutions I have found on the internet.
Unable to run Get-PsRepository, Install-Module, and related (OneGet?) commands without them throwing the "Unable to find module providers (PowerShellGet)" error. This appears to be an issue with the NuGet packagemanager module but I do not know how to recover. The package provider installed appears valid
Symptom patterns:
C:> [Net.ServicePointManager]::SecurityProtocol
Tls12
Get-PSRepository
PackageManagement\Get-PackageSource : Unable to find module providers (PowerShellGet).
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4496 char:31
+ ... ckageSources = PackageManagement\Get-PackageSource #PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource
], Exception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource
Register-PSRepository -Default -Verbose
VERBOSE: PowerShell meta provider initialization failed.
VERBOSE: No match was found for the specified search criteria and provider name 'PowerShellGet'. Try
'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.
PackageManagement\Register-PackageSource : Unable to find module providers (PowerShellGet).
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4211 char:17
+ ... $null = PackageManagement\Register-PackageSource #PSBoundParamete ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-Pac
kageSource], Exception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource
Install-Module PowerShellGet -Force
PackageManagement\Install-Package : Unable to find module providers (PowerShellGet).
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ... $null = PackageManagement\Install-Package #PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Facts:
Windows 10 (1903)
Powershell 5.1.18362.1171
Running PowerShell as Administrator
Not behind a proxy
Have access to https://www.powershellgallery.com/api/v2
Have access to nuget.org
`[Net.ServicePointManager]::SecurityProtocol = Tls12
FIPS is disabled (HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\Enabled DWORD=0)
Get-PackageProvider shows only NuGet 2.8.5.208
PowerShellGet version is 1.0.0.1 ; when trying force a sxs install with Install-Module PowerShellGet -Force I get the same: PackageManagement\Install-Package : Unable to find module providers (PowerShellGet).

We encountered the same problem. Found this thread without a solution. But I dug a bit further and on the computer that had this problem we found version 1.4.7 of PackageManagement installed.
After removing this folder everything started working normally. I have not found how this thing got installed. Seems like a legit powershell module from Microsoft but it's interacting with the 'normal' PowershellGet module and seems to break it.
For us it was located in the %USERPROFILE%/documents/WindowsPowershell/Modules.
Also worth nothing that this %USERPROFILE% was a corporate OneDrive.
Edit: Microsoft have fixed this issue: https://github.com/PowerShell/vscode-powershell/issues/3432

Not enough Rep to comment.
I ended up in the same situation. A Windows 10 1909 machine, with
%USERPROFILE%/document being a corporate OneDrive. Moving
PackageManagement out of /WindowsPowerShell/ changed
Get-PSRepository's output from nothing to PSGallery. Thanks! – tmcg
Mar 1 at 21:35 This was exactly the same issue. I suspect this is
because PowerShell 7 dumped it into this location (possibly Visual
Studio Code when it prompt to update?) – aolszowka Mar 1 at 22:09
I encountered the same issue with packagemanagement in %USERPROFILE%/documents on my personal profile. The file dates matched when I installed VScode and the Powershell Extensions on this new machine.
Removing the folder from modules corrected the issue for the time being.

In addition to removing %USERPROFILE%/Documents/WindowsPowershell/Modules folder, I also found that putting the package manger locally helped powershell.exe -NoLogo -NoProfile -Command 'Save-Module PackageManagement -MinimumVersion 1.4.7 -LiteralPath ""C:\Program Files\WindowsPowerShell\Modules\""' thanks to itsho here https://github.com/PowerShell/vscode-powershell/issues/2824#issuecomment-750902181
The cause is due to the %USERPROFILE%/Documents folder being on a OneDrive and module-install keeps installing the PackageManagement module to user documents by default ignoring PSModulePath, even had the OneDrive location removed/changed.
This my module path from running PS inside vscode identifying info removed:
$env:PSModulePath -split ';'
C:\Users\{myUsername}\OneDrive - {myCompanyName}\{company}\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
There are more things that can be done to fix this from happening again discussed here https://github.com/PowerShell/PowerShell/issues/15552#issuecomment-1002708799
Like setting the documents folder to local and off OneDrive like shown here https://support.microsoft.com/en-us/topic/configuration-of-the-my-documents-folder-dfd9a90d-8f80-18d6-e7cc-f1566fc3b10b
I followed these steps for now.
In explorer to the left under quick access right click Documents, and then click Properties.
Change to the location tab in the configuration box and type the new path to the Documents folder, I used the local one
Click No so the existing files do not move and still can be accessed by going into OneDrive. I also added another quick access folder for my OneDrive location, but that is up to you.
Note: This effects other programs as well like the default save location for PowerPoint. You'll need to be mindful that you don't save something local thinking it will be backed up to OneDrive.
My module paths after the change:
$env:PSModulePath -split ';'
C:\Users\{myUsername}\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
Another workaround could be to have OneDrive keep the files local.
Navigate to %USERPROFILE%/Documents
Right click WindowsPowershell and select "Always keep on this device".
I haven't been able to test this one, but it might be the least impactful way to address this.

Related

Firefox automation using Selenium Powershell ISE, Windows 10

PS ISE 5.1
Windows 10
Has anyone had luck with Firefox automation using Selenium with PS ISE? Below, I have two different examples below where in each method I am unsuccessfully able to open the firefox browser, let alone navigate anywhere. I'll explain more under each method.
Method 1) Install of Selenium PS Module:
Source:
https://github.com/adamdriscoll/selenium-powershell
In the following method, I installed a module that is supposed to be a powershell wrapper for C# Selenium. The error is triggered from module itself. I have placed the error message in the comment block below. How would I find which "assembly" is needed, that contains this "type"?
cls
$website = "https://www.google.com/"
Import-Module "C:\Program Files\WindowsPowerShell\Modules\Selenium\3.0.1\Selenium.psm1" -Function *
$Driver = Start-SeFirefox
Enter-SeUrl $website -Driver $Driver
Cannot find the type for custom attribute 'ValidateURIAttribute'. Make sure that the assembly that contains this type is loaded.
At C:\Program Files\WindowsPowerShell\Modules\Selenium\3.0.1\Selenium.psm1:403
char:9
+ [ValidateURIAttribute()]
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ([ValidateURIAttribute()]:AttributeAst) [], RuntimeException
+ FullyQualifiedErrorId : CustomAttributeTypeNotFound
Cannot find the type for custom attribute 'ValidateURIAttribute'. Make sure that the assembly that contains this type is loaded.
At C:\Program Files\WindowsPowerShell\Modules\Selenium\3.0.1\Selenium.psm1:580
char:9
+ [ValidateURIAttribute()]
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ([ValidateURIAttribute()]:AttributeAst) [], RuntimeException
+ FullyQualifiedErrorId : CustomAttributeTypeNotFound
Method 2) Downloaded geckodriver.exe and WebDriver.dll
Sources:
https://www.reddit.com/.../getting_started_in_web.../
https://adamtheautomator.com/selenium-powershell/
https://www.selenium.dev/downloads/
In this example, I have downloaded geckodriver.exe and WebDriver.dll, placed them both in the same folder and added the folder to my system's environment variables. I've added a comment block below showing the error message. I commented out the Add-type call as it gave me different errors and it didn't load the webdriver, so I used the loadform call instead. Which file is the error referencing to? The code is using the DLL file; I know this because FireFoxOptions line of code works and the code opens the exe, so that clearly is found as well. There are only 2 files and both are working to some degree. The line that's not working is
$Firefoxdriver = New-Object OpenQA.Selenium.Firefox.Firefoxdriver($Firefoxoptions)
This would be a function from the dll file; can it not find the EXE at this point, even though the code had already executed the EXE file? Regarding the GAC = false, I read that not all DLL's can be registered with the system because some don't have all the necessary functions; I'm not sure if that's required or not.
cls
$PathToFolder = 'F:\Programs\Selenium\WorkingDirectory'
if ($env:Path -notcontains ";$PathToFolder" ) {
$env:Path += ";$PathToFolder"
}
[System.Reflection.Assembly]::LoadFrom("{0}\\WebDriver.dll" -f $PathToFolder)
#Add-Type -Path "$($PathToFolder)\WebDriver.dll"
$Firefoxoptions = New-Object OpenQA.Selenium.Firefox.Firefoxoptions
#$Firefoxoptions.AddArgument('-headless') ##### <----- Used to make the window not appear, or 'headless' - comment out to have a normal window show.
$Firefoxoptions.AcceptInsecureCertificates = $True
$Firefoxdriver = New-Object OpenQA.Selenium.Firefox.Firefoxdriver($Firefoxoptions)
pause
GAC Version Location
--- ------- --------
False v4.0.30319 F:\Programs\Selenium\WorkingDirectory\WebDriver.dll
New-Object : Exception calling ".ctor" with "1" argument(s): "Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0,
Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified."
At F:\Programs\PowerShell\SeleniumFireFox.ps1:15 char:18
+ ... foxdriver = New-Object OpenQA.Selenium.Firefox.Firefoxdriver($Firefox ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: 🙂) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
Press Enter to continue...:
Here is a snippet of the Java code that works in Eclipse. I wonder if what I'm missing in the code above is whatever the System.setProperty is doing in Java?
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","F:\\Programs\\Selenium\\GeckoDriver\\geckodriver-v0.29.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
String baseUrl = "https://www.google.com/";
String expectedTitle = "Google";
String actualTitle = "";
// launch Fire fox and direct it to the Base URL
driver.get(baseUrl);
Additional notes (partly just venting): The reason I'm trying to do this in powershell is because I know powershell more; it's generally easier for me to write code. In my example, I am trying to combine two pieces of working code together; one of them is the Firefox automation in Java and the other is an api call in Powershell. My first attempt was to port the powershell code into Java, but I don't know Java well and the littlest things were frustrating me. In Java, I couldn't figure out how to make the API call which was so simple in powershell; simply using Invoke-RestMethod. The answers I found online to do that were saying that it's actually complex in Java because I would need to manage cookies and do all sorts of stuff. I couldn't even find consistent date functions; different answers were importing different date function modules and it made combining code difficult. So, I decided to try and port my Java code to Powershell. The code I'm using works for other people, at least according to the answers I've found online, but do not work for me.
It looks like you are not importing the full module, is this on purpose? If Selenium is in your modules path, you should be able to run:
Import-Module Selenium
If that's not possible, most modules have a .psd1 file that should be the import target, and may load other .psm1 files, nested modules, assemblies, etc. Your github link recommends the following:
Import-Module "{FullPath}\selenium-powershell\Selenium.psd1"
At the very least, you are missing a type definition - these are usually included in .dll or .xml files with the module, and can be seen with get-module once imported under ExportedTypeFiles:
(Get-Module ActiveDirectory).ExportedTypeFiles
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ActiveDirectory\ActiveDirectory.Types.ps1xml

Need help understanding error "manifest is not in the package root" while registering Windows 10 package

I am trying to register the Windows 10 Edge package with Windows Server 2016. I have successfully installed the store thanks to a forum I found and it opens but remains untested. I am trying to do the same with Edge. I've copied the app package from the installer iso to C:\Windows\systemapps and ran the power shell script:
Add-AppxPackage -register "C:\windows\systemapps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\Appxmanifest.xml" -DisableDevelopmentMode
And get the following error:
Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF9, Install failed. Please contact your software vendor.
(Exception from HRESULT: 0x80073CF9)
Rejecting a request to register from Appxmanifest.xml because the manifest is not in the package root.
NOTE: For additional information, look for [ActivityId] a80e1223-2787-0000-dc3e-12a98727d301 in the Event Log or use
the command line Get-AppxLog -ActivityID a80e1223-2787-0000-dc3e-12a98727d301
At line:1 char:1
+ Add-AppxPackage -register "C:\windows\systemapps\Microsoft.MicrosoftE ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\windows\syst...ppxmanifest.xml:String) [Add-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
I've verified the manifest is in the package root so other than that I can't figure out what it means. Can someone help me understand what it's looking for?
Reference for store install: http://virtualcustoms.net/showthread.php/72904-Install-Microsoft-Store-and-Apps-on-Windows-10-LTSB-2016
I was just trying to do the same thing and I have found if I copy the app to C:\Program Files\WindowsApps then it installs without complaining about not being in the root and then the Edge icon also appears on the start menu.
The command to run is:
Add-AppxPackage -DisableDevelopmentMode -Register "C:\Program Files\WindowsApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AppxManifest.xml"
Whilst this allows the app to install and I am able to launch it from the start menu it closes after about 2 seconds and looking in the log (Application and Service Logs\Microsoft\Windows\Apps\Microsoft-Windows-TWinUI/Operational it shows this error so it looks like there is still something else that needs to be done to get this working:
ActivateApplicationForContractByAppIdAsUserWithHost of the app Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge for the Windows.Launch contract failed with The app didn't start..
Robin
I found it difficult to add to the win apps folder but figured out as long as the location of the apps you want to add are located in a folder named C:\Program Files\WindowsApps* it will work. I use a folder named “WindowsApps-Import” in the programs folder, works well!
One answer suggests adding the -DisableDevelopmentMode flag to the command you've ran, which works, but leaves an important point out.
Once the app installs, it won't run and crashes soon after. This is because the ALL APPLICATION PACKAGES group doesn't have access to the folder of the app. Giving ALL APPLICATION PACKAGES full control of the app folder will allow it to run.
Move the folder inside: "C:\Users$USERNAME\AppData\Local\Packages" then it works. Obv developer mode on windows needs to be ON.
for eg:
Add-AppxPackage -Register "C:\Users\Amit\AppData\Local\Packages\WsaPackage_1.7.32815.0_x64_Release-Nightly\AppxManifest.xml"

Windows Store and All Apps Crash Immediately After Opening [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
My computer has gotten into a situation where, whenever I open a Windows Store app or the Windows Store itself, the splash screen appears for a few seconds and then it crashes. I am unable to use any Windows Store apps. Also, I tried many, many different proposed solutions that I found on the internet to no avail.
I methodically followed-up every error log and finally was able to fix this problem.
The problem appears to be widespread based on all the complaints I've seen on the internet.
This has to be one of the most annoying problems I’ve ever faced with Windows. None of the “easy” solutions worked for me, but I dug deep and finally was able to fix this. Here’s how I did it. (Note: As always, I’m not responsible for any damage that may arise from you following my advice.)
Run Powershell as administrator by hitting the start button, typing
“Powershell” then right-clicking “Windows PowerShell” and clicking
“Run as Administrator”.
Try re-installing your Windows Store app by
running the following two commands:
$manifest = (Get-AppxPackage Microsoft.WindowsStore).InstallLocation + '\AppxManifest.xml'
Add-AppxPackage -DisableDevelopmentMode -Register $manifest
If you don’t get any errors, skip to step 14 (lucky you!)
If you do get an error, display the error log. First, you have to
find the code for the error log.
Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF6, Package could not be registered. (Exception from HRESULT: 0x80073CF6)
NOTE: For additional information, look for [ActivityId] aaa7357d-bec0-0001-5f4f-a8aac0bed101 in the Event Log or use the command line Get-AppxLog -ActivityID aaa7357d-bec0-0001-5f4f-a8aac0bed101
At line:1 char:1
+ Add-AppxPackage -register "C:\Program Files\WindowsApps\Microsoft.Win ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Program File...ppxManifest.xml:String) [Add-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Look where it says “…use the command line Get-AppxLog…” and then copy and paste everything from Get-AppxLog to the end of the line, as follows:
Get-AppxLog -ActivityID aaa7357d-bec0-0001-5f4f-a8aac0bed101
You will see a lot of output. At the end, you should see the exact reason why the command failed. In my case, it looked like this:
error 0x80070002: Reading manifest from location:
C:\ProgramData\Microsoft\Windows\AppRepository\Microsoft.WindowsStore_11602.1.26.0_neutral_split.scale-125_8wekyb3d8bbwe.xml failed with error: The system cannot find the file specified.
So, it can’t find the XML file that it needs. In this case, we can “cheat” by copying a file that we DO have in place of the file that is missing. First, we have to find an appropriate file that we do have available to us. To do this, go to the directory that stores all the XML files, as follows:
cd C:\ProgramData\Microsoft\Windows\AppRepository
Next, list all the files that start with Microsoft.WindowsStore, as follows:
dir Microsoft.WindowsStore*
The result looks like this:
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 4/30/2016 10:09 AM 31341 Microsoft.WindowsStore_11602.1.26.0_x64__8wekyb3d8bbwe.xml
-a---- 4/30/2016 10:09 AM 28503 Microsoft.WindowsStore_11602.1.264.0_neutral_~_8wekyb3d8bbwe.xml
-a---- 1/29/2016 8:28 PM 28502 Microsoft.WindowsStore_2015.2524.4.0_neutral_~_8wekyb3d8bbwe.xml
-a---- 1/13/2016 9:11 AM 28065 Microsoft.WindowsStore_2015.83.24.0_neutral_~_8wekyb3d8bbwe.xml
-a---- 2/13/2016 11:43 PM 28283 Microsoft.WindowsStore_2016.272.4.0_neutral_~_8wekyb3d8bbwe.xml
-a---- 3/10/2016 9:04 AM 28503 Microsoft.WindowsStore_2016.2913.4.0_neutral_~_8wekyb3d8bbwe.xml
In my case, I had another file that was pretty close to the file that was needed. It had the same version number 11602.1.26.0 as the file that was missing, so I just copied that one.
cp Microsoft.WindowsStore_11602.1.26.0_x64__8wekyb3d8bbwe.xml C:\ProgramData\Microsoft\Windows\AppRepository\Microsoft.WindowsStore_11602.1.26.0_neutral_split.scale-125_8wekyb3d8bbwe.xml
Here I ran into a VERY annoying permissions error, which led me down another rabbit hole. When I tried to copy the file, I got this error:
cp : Access to the path 'C:\ProgramData\Microsoft\Windows\AppRepository\Microsoft.WindowsStore_11602.1.26.0_neutral_split.language-ja_8wekyb3d8bbwe.xml' is denied.
At line:1 char:1
+ cp Microsoft.WindowsStore_11602.1.26.0_x64__8wekyb3d8bbwe.xml C:\Prog ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\ProgramData\...ekyb3d8bbwe.xml:FileInfo) [Copy-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : CopyFileInfoItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.CopyItemCommand
I had to give myself full control over the AppRepository directory in order to be able to write files into it. The standard Security tab on the File Properties dialog box wasn’t working for me, so I installed a PowerShell cmdlet that allows you to change file permissions from inside PowerShell. Follow these instructions to install the cmdlet.
First, you must enable running scripts in your Powershell session,
as follows:
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Unrestricted
Next, download the NTFSSecurity.zip file at this URL
https://gallery.technet.microsoft.com/scriptcenter/1abd77a5-9c0b-4a2b-acef-90dbb2b84e85
IMPORTANT: The installation instructions in the URL above neglect an important part of the process. Before you unzip the ZIP file you downloaded, you must first “unblock” it, as follows:
Unblock-File C:\Users\xxxxx\Downloads\NTFSSecurity.zip
Where “xxxxx” above is your user name. If you downloaded the file somewhere else, just enter the full path to the downloaded file. Now that you have unblocked the file, you can then unzip it and install it as per the instructions at the URL above. I unzipped it into this folder:
C:\Users\xxxxx\Documents\WindowsPowerShell\Modules\NTFSSecurity
Then, to install it, I typed:
Import-Module NTFSSecurity
You can now give yourself permissions to the Windows Store folder, as follows:
Add-NTFSAccess -Path C:\ProgramData\Microsoft\Windows\AppRepository -Account JIMSURFACEPRO4\chaos -AccessRights FullControl -AccessType Allow -AppliesTo ThisFolderSubfoldersAndFiles
For -Account you must substitute your own user account. To find your user account, type:
whoami
Now that you have permission to the AppRepository directory, you can try the copy command again:
cp Microsoft.WindowsStore_11602.1.26.0_x64__8wekyb3d8bbwe.xml C:\ProgramData\Microsoft\Windows\AppRepository\Microsoft.WindowsStore_11602.1.26.0_neutral_split.scale-125_8wekyb3d8bbwe.xml
Continue running the command in step 2 (just the second command) and each time it gives you an error, run the Get-AppxLog, find the name of the missing XML file, and copy your existing file to the missing file name (step 12, above).
Eventually, you will stop getting missing file errors. In my case, I began getting different errors, as follows:
error 0x80070005: While processing the request, the system failed to register the windows.stateExtension extension due to the following error: Access is denied.
.
6/5/2016 7:05:32 PM 316 error 0x80070005: Cannot register the request because the following error was encountered during the registration of the windows.stateExtension extension: Access is denied.
You won’t believe this, but I solved this problem by… turning off the Windows Firewall. To do this, hit the start button then type “Firewall” and then click on “Windows Firewall”. In the window that shows up next, Click “Turn Windows Firewall On or Off” and then turn it off for all networks.
I then finally was able to succeed with the command:
Add-AppxPackage -DisableDevelopmentMode -Register $manifest
I checked that Windows Store was working by hitting the start button, typing “Store” and clicking on “Store”. It opened up properly and didn’t crash. Hooray!
Finally, you have to fix all of your remaining apps. You can try this command which automatically re-registers all of your apps. Make sure that the Windows Store is closed when you run this command.
Get-AppxPackage -allusers | foreach {Add-AppxPackage -register "$($_.InstallLocation)\appxmanifest.xml" -DisableDevelopmentMode}
However, in my case, many of the apps still failed and it was mostly due to missing files. Since I noticed that the file names followed a pattern, I was able to write this scary Powershell command that created all the missing files:
Get-AppxPackage -allusers | foreach {$scr = "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_$($_.Architecture)__$($_.PublisherId).xml"; if (Test-Path $scr) { cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.language-ja_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_ja-jp_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_zh-cn_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_resources.language-zh-hans_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_resources.scale-125_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_resources.scale-140_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_resources.scale-150_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_resources.language-ja_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.language-zh-hans_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.scale-100_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.scale-125_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.scale-150_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.scale-140_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.scale-200_$($_.PublisherId).xml"; cp $scr "c:\ProgramData\Microsoft\Windows\AppRepository\$($_.Name)_$($_.Version)_neutral_split.scale-180_$($_.PublisherId).xml"; } }
I then re-ran step 17 and most of the apps succeeded.
Finally, open the Windows Store, click on Apps, click the download icon and then check for updates. Install all available updates.
Don’t forget to re-enable your Windows Firewall!!!
If you have any questions, please feel free to comment below! Let me know if this actually helps. As always, I’m not responsible for any damage that may arise from you following my advice.
References
http://www.intowindows.com/how-to-reinstall-store-and-other-preinstalled-apps-in-windows-10/
https://technet.microsoft.com/en-us/library/hh856048.aspx
https://social.technet.microsoft.com/Forums/en-US/35d5669c-a5af-4c14-b3cd-8cdb5c745525/addappxpackage-hresult-0x80073cf6-package-could-not-be-registered-merge-failure-error?forum=win10itprogeneral&prof=required
https://blogs.technet.microsoft.com/heyscriptingguy/2014/11/22/weekend-scripter-use-powershell-to-get-add-and-remove-ntfs-permissions/
https://gallery.technet.microsoft.com/scriptcenter/1abd77a5-9c0b-4a2b-acef-90dbb2b84e85
http://www.askvg.com/guide-how-to-reinstall-all-default-built-in-apps-in-windows-10/
I upgraded from Windows 7 Home 64-bit to Windows 10 Enterprise 64-bit on a 6 year old Dell Inspiron 620. The windows store was partially downloading, then it would stop and give error message. ...05. I tried to download new apps for 3 days and nothing worked (new user account, changing softwaredistribution to softwaredistribution.old, a slew of recommend powershell commands such as Get-AppX, changing permissions on WindowsApps folder, etc, etc.
My other problem was that when I went to Settings, Update and Security, and clicked on Windows Update, the screen was blank, flashes, then the window immediately closed
I finally found a solution that fixed BOTH problems... the repair tool at http://www.tweaking.com/files/setups/tweaking.com_windows_repair_aio_setup.exe Download that file and install it, then reboot to Safe Mode and run it.
I used this free repair tool above and did not run any of the Pre-Repair Steps. I clicked on Repairs-Main and ran everything except #6, #7, #12, #17, #19, #24, #31, #32, #33 because I had no problems with those items.
Now, my Windows Store works fine and so does the Windows Update settings in Settings, Update and Security. I hope this helps someone.
Please people when you finally find a working solution and post it. So many do not.

Unable to set certificate friendly name through PowerShell (access is denied)

I'm trying to update a (root) certificate's friendly name through PowerShell.
The certificate I'm trying to update is highlighted in the screenshot below (taken from certmgr.msc):
Here's the PowerShell code (largely taken from here):
Set-Location cert:
cd .\CurrentUser\Root
$cert = gci .\02FAF3E291435468607857694DF5E45B68851868
$cert.FriendlyName = "UserTrust CA"
(I've verified the thumbprint with the certificate properties in certmgr.msc to make sure it's the same certificate).
The last line will result in the following error:
Exception setting "FriendlyName": "Access is denied.
"
At line:1 char:7
+ $cert. <<<< FriendlyName = "UserTrust CA"
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
I've tried the following things so far:
Running PowerShell as administrator
Changing the execution policy using: Set-ExecutionPolicy Unrestricted
Other information:
PowerShell version is 2.0 (running on Windows 7 Enterprise x64)
I'm running the x64 version of PS
DEP and UAC are disabled
My account is part of the Administrators group
I'm a complete PowerShell n00b ;-)
PS version output:
$PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
You need to update your version of Powershell to 3.0 or 4.0.
See Get-ChildItem for Certificate
I have Powershell 4.0 and I was able to change the FriendlyName without problems. This was visible in certmgr.msc after a restart.
You can download Powershell 4.0 here.
If you are a Powershell beginner it's probably better to use Get-ChildItem instead of gci for improved readability. Also, cd is an alias of Set-Location so it's better to choose one or the other in your script to avoid confusion.

How can I troubleshoot the installation of this Nuget package?

I am trying to install the EnterpriseLibrary for Transient Fault Handling. This is a Microsoft package. When i try to install it I am getting the following error :
Install failed. Rolling back...
Install-Package : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 char
acters, and the directory name must be less than 248 characters.
At line:1 char:16
+ Install-Package <<<< EnterpriseLibrary.WindowsAzure.TransientFaultHandling
+ CategoryInfo : NotSpecified: (:) [Install-Package], PathTooLongException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I have tried selecting the package from the Nuget ui. I have tried manually installing the package using the Nuget command line.
I have tried manually installing the dependencies one by one. It fails on the same package every time.
My project location is the default MyDocuments/visualstudio/projects location.
Any ideas ?
It looks like your project path is long enough that when the package is installed, adding the package folder fails because it reached the qualified name length limit.
I mean :
[drive]:\Users[user]\Documents\Visual Studio 2010\Projects[yourproject]\packages\ +
\EnterpriseLibrary.WindowsAzure.TransientFaultHandling\
has more than the limit.
Can you move you project somewhere else ?
In addition to Alexandre's answer:
You can use the subst command to keep your path shorter. For example I had a similar problem and used
subst P: "C:\Users\[username]\Documents\Visual Studio [year]\Projects"
to create a new P: drive (p for projects) and shorten the length of the path by many characters. Make sure that you open the solution by navigating to the solution under P: not C:\Users\Docs..., and you might want to delete any shortcuts (particularly recently opened projects) to the solutions under C:.
You can also create a batch file that contains this and put it in Start Menu/Startup (or C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) which will run it every time that you start your computer and mean that you always have a P: drive.
I have also got the same error but it got easily resolved , when i moved my package to one upper level
drive , or u can probably keep your project inside one folder in
it will surely work rather than giving a lengthy path
drive:\[folder1]\Documents\Visual Studio 2010[folder2][projectname]\ .. \
which exceeds the limit of 248 characters
I have been facing the similar issue, however, what I did was to manually download the file (.nupkg file extension) and then clicking on settings in the Manage NuGet Packages
Then select your downloaded package (Keep it in a separate folder, you may keep all your downloaded package files in this folder) and update
Yes previously my project was in Desktop,I just moved it to one of my Drive,re-started the project,its start worked for me.

Resources