How install Oracle package for Oracle.ManagedDataAccess.dll in VS Code - oracle

I'm trying to install the above package in VS Code. For some reason when I put this at the top of my script I get an error message.
using namespace system.collections.generic
Add-Type -AssemblyName System.Data.OracleClient
Add-Type -Path "C:\Users\me\OneDrive - company\Documents\2021\temp endToEnd\oracle.ManagedDataAccess.Core\oracle.manageddataaccess.core.3.21.50\lib\netstandard2.1\Oracle.ManagedDataAccess.dll"
Error:
Add-Type : Missing an argument for parameter 'AssemblyName'. Specify a parameter of type 'System.String[]' and try again.
I also tried Add-type -Path "C:\Users\me\OneDrive - company\Documents\2021\temp endToEnd\oracle.ManagedDataAccess.Core\oracle.manageddataaccess.core.3.21.50\lib\netstandard2.1\Oracle.ManagedDataAccess.dll"
And it had this error:
Add-Type : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
My question is, how do I load this, so I can do the following:
$connectionString = "Data Source=$dataSource;User Id=$username;Password=$password;"
$con = New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectionString)
I am trying to install this package because I have this error when I try to execute the last code line above:
New-Object : Cannot find type [Oracle.ManagedDataAccess.Client.OracleConnection]: verify that the assembly containing this type is loaded.
I tried doing it through nuget manager as well, with ctrl shift P, nuget manager, but it's not coming up in the list that I can see (odp.net, oracle managed..., etc).
I had download this from the oracle website:
oracle.manageddataaccess.core.3.21.50.nupkg
Then I used 7-zip to unzip it to the location I'm Add-Type from.
I've been looking at these links:
New-object Oracle.ManagedDataAccess.Client.OracleConnection
oracle-developer-tools-vs-code
install nuget package in vs code
I can't seem to get this installed so the command works in the script. Any help would be appreciated.

You're basically treating powershell like a client application, you'll want: the Oracle Data Application Client(ODAC) driver, powershell is a managed memory model so you'll want the managed one, and most likely the 64-bit one unless for some reason you're running 32-bit powershell... Beyond that it'll likely depend on which version works best for your Oracle database.
For example 12cR1:
Download ODP.NET_Managed_ODAC122cR1.zip
extract odp.net\managed\common\Oracle.ManagedDataAccess.dll
PS C:\working> add-type -path (ls .\Oracle.ManagedDataAccess.dll).FullName
PS C:\working> $OraEntry = '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=database.example.com)(Port=1234)))(CONNECT_DATA=(service_name=BigData)))'
PS C:\working> $con = [Oracle.ManagedDataAccess.Client.OracleConnection]::new()
PS C:\working> $con.ConnectionString = "Data Source=$OraEntry;User Id=$username;Password=$password"
PS C:\working> $con.Open()
If you don't know what the OraEntry should be you can likely copy it from your tnsnames.ora and/or check with your database admin

Have a look at How the Runtime Locates Assemblies
Most common .NET assemblies are loaded either from current directory or from Global Assembly Cache (GAC). The GAC takes precedence over locally stored files.
Check files in your downloaded package, there should be the OraProvCfg.exe. Use it for adding the dll into GAC and doing the configuration:
OraProvCfg.exe /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:"C:\Users\me\OneDrive - company\Documents\2021\temp endToEnd\oracle.ManagedDataAccess.Core\oracle.manageddataaccess.core.3.21.50\lib\netstandard2.1\Oracle.ManagedDataAccess.dll"

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

Corrupt PackageManager? Unable to find module providers (PowerShellGet)

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.

DbaTools Error. How to fix 'Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo' when running Export-DbaInstance

I'm running
Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir
and getting the error 'Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo'
I tried installing Microsoft Visual C++ Redistributable for Visual Studio 2013 and 2017
I tried adding the DLL in question(which IS contained in the DbaTools module) to the GAC using the CMD below
gacutil.exe /i "C:\Program Files\WindowsPowerShell\Modules\dbatools\bin\smo\Microsoft.SqlServer.ConnectionInfo.dll"
I tried installing the newest version of DbaTools(~0.9.x at time of writing) using the Powershell below
Invoke-Expression (Invoke-WebRequest -UseBasicParsing https://dbatools.io/in)
Inputted command and complete outputted error message are both below
Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir
'Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo' Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 or one of its dependencies. The system cannot find the file specified.'
If I opt out of exporting replication settings, there is no attempt to load the problematic assembly, and the cmdlet runs as expected.
Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir -Exclude 'ReplicationSettings'

How to deploy SSIS project with encrypted data?

We have a SSIS project where one of the packages is connecting to a REST API. We use the HTTP connection manager (with username/password) and a script component to open the connection manager and parse the response. Protection level for all packages are EncryptSensitiveWithUserKey. Everything works in Visual Studio, and can be deployed with Deployment Wizard to the SSIS-DB. In the SSIS-DB we can run the package, and also change connection manager password/username via environments.
But we are not able to achieve this via our normal automated deployment: Check-in to TFS and use VSTS-buildserver with Powershell scripts. When running the package from SSIS-db we get:
Failed to decrypt protected XML node "DTS:Property" with error 0x80070002 "The system cannot find the file specified.".
You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
We (believe we) know how SSIS protection levels and encryption works, and the cause is obvious: The SSIS file is encrypted with user key, and the Deployment Wizard (run by developer!) decrypts/re-encrypts with the SSIS-catalog key. But the build server does not have the user key, hence the decryption-step is invalid.
However, we would expect that this should not be an issue, since the password is replaced by the SSIS-environment, but is gives the above error.
We have tried all protection levels:
DontSaveSensitive: Package can't run in either VS/SSISDB.
EncryptSensitiveWithPassword: Passwords are unsupported in the PowerShell $folder.DeployProject command. Same method as here.
With EncryptSensitiveWithUserKey mode, you can try to setup build/release agent on your machine and change service account to your account, then deploy through this agent.
I am encountering the same problem now with Azure DevOps and the SSIS DevOps tasks targeting SQL Server 2016.
I suspect that using the Microsoft.SQLServer.Management.IntegrationServices assembly behaves differently to the ISDeploymentWizard executable.
I have found that this issue occurs for sensitive package parameters only and not project parameters so one solution is to replace your sensitive package parameters with project parameters.
The issue would occur when running the package with the sensitive package parameter from the catalog but in some cases the package would run without issue when executed as a child package.
I also found that some packages would report successful package execution but looking at the event messages the Failed to decrypt protected XML node "DTS:Property" with error 0x80070002 would be present.
An alternative solution is to execute the ISDeploymentWizard from the command line. This does require that the target catalog folder already exists as the wizard will not create it. Therefore a step is needed before this to create the catalog folder if it does not already exist.
PowerShell script below should work for SQL Server 2016 as is:
### Variables
$targetServer = "localhost"
$targetCatalogFolder = "IsDeploymentWizard"
$sourceFolder = "C:\Users\mhept\source\repos\SsisDeploy\AzureDevOpsSensitiveInChildPackage"
### Ensure Target Catalog Folder Exists
Add-Type -AssemblyName "Microsoft.SQLServer.Management.IntegrationServices, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"
$ssisNamespace = "Microsoft.SqlServer.Management.IntegrationServices"
# Create a connection to the server
$sqlConnectionString = "Data Source=" + $targetServer + ";Initial Catalog=master;Integrated Security=SSPI;"
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $sqlConnectionString
# Create the Integration Services object
$integrationServices = New-Object $ssisNamespace".IntegrationServices" $sqlConnection
# Get the Integration Services catalog
$catalog = $integrationServices.Catalogs["SSISDB"]
$catalogFolder = $catalog.Folders[$targetCatalogFolder]
if($null -eq $catalogFolder){
# Create the target folder
Write-Host "Creating Catalog Folder $targetCatalogFolder"
$catalogFolder = New-Object $ssisNamespace".CatalogFolder" ($catalog, $targetCatalogFolder, "")
$catalogFolder.Create()
}
$targetCatalogPath = "/SSISDB/$targetCatalogFolder"
$ispacs = Get-ChildItem -Path $sourceFolder -Filter "*.ispac" -Recurse
$isDeploymentWizard = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\SSIS\Setup\DeploymentWizardPath" -Name "(default)"
foreach($ispac in $ispacs) {
$projectName = $ispac.BaseName
$sourcePath = $ispac.FullName
Write-Host "Deploying $projectName ..."
Start-Process -Wait -FilePath $isDeploymentWizard -ArgumentList "/Silent", "/SourceType:File", "/ModelType:Project", "/SourcePath:$sourcePath", "/DestinationServer:$targetServer", "/DestinationPath:$targetCatalogPath/$projectName"
Write-Host "Successfully deployed $projectName"
}

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"

Resources