2015-12-10 20 views
5

Non ho provato a installare un'app universale per Windows 10 con il servizio remoto di PowerShell. Ho provato tutto ciò a cui riesco a pensare, quindi ora mi rivolgo a te sperando che qualcuno possa fornirmi una risposta o una spiegazione sul perché il mio approccio non funziona. Sono anche apprezzate soluzioni alternative.Installazione di Windows 10 con il servizio remoto di Powerhell

In sostanza ciò che voglio fare è poter installare un'app di Windows 10 in remoto e il mio approccio consiste nel scaricare il file sul computer di destinazione e utilizzare il servizio remoto di PowerShell per eseguire l'installazione. Questa è una versione bollito giù del mio script:

$computerName = 'XYZ' 
$userName = 'abc' 
$newCred = Get-Credential "$computerName\$userName" 
$newSession = New-PSSession -ComputerName $computerName -Credential $newCred -ErrorAction Stop 
Invoke-Command -Session $newSession -ErrorAction Stop -Verbose -Scriptblock { 

function installApp($srcDirectory) { 
    $installer = Get-ChildItem "$srcDirectory\App.Test*\Add-AppDevPackage.ps1" | Select-Object -ExpandProperty FullName   
    &($installer)    
} 

$srcDirectory = "$($env:TEMP)/TestApp" 
    installApp($srcDirectory) 
} 

Remove-PSSession $newSession 

In sostanza tutto ciò che cerca di fare è quello di eseguire lo script generato che sono stati generati in Visual Studio al fine di installare l'applicazione. Ma quando l'eseguo ottengo il seguente:

Installing app... 

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF6, Det gick inte att registrera paketet. 

error 0x80070005: Adding a tile failed with unexpected error. 

NOTE: For additional information, look for [ActivityId] a3f9b89b-3292-000113ea-f9a39232d101 in the Event Log or use the command line Get-AppxLog -ActivityID a3f9b89b-3292-0001-13ea-f9a39232d101 

At C:\Users\abc\AppData\Local\Temp\App\TestApp_1_0_0\Add-AppDevPackage.ps 1:392 char:13 
+    Add-AppxPackage -Path $DeveloperPackagePath.FullName - 
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo   :  (C:\Users\abc..._arm.appxbundle:String) [Add-AppxPackage], IOException 
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand 

Error: Could not install the app. 

E l'uscita dal Get-AppxLog -ActivityID a3f9b89b-3292-0001-13ea-f9a39232d101 è:

Time      ID   Message                               
----      --   -------                               
2015-12-10 10:45:39  301   The calling process is wsmprovhost.exe                       
2015-12-10 10:45:39  603   Started deployment Add operation on a package with main parameter: Test.App_1.1.1.0_x86_x64_arm.appxbundle and Options: Fo 
             rceApplicationShutdownOption. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.  
2015-12-10 10:45:40  164   The app bundle signature was validated for core content of the app bundle published by CN=xxx. App packages won't be validated 
             until they are read.                            
2015-12-10 10:45:40  391   The bundle streaming reader was created successfully for bundle 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutra 
             l_~_m042xdac27ax6.                            
2015-12-10 10:45:40  10002  Creating Resiliency File C:\ProgramData\Microsoft\Windows\AppRepository\d195e8d8-35c4-4b85-bb4f-d99c525791c1_S-1-5-21-3220428687- 
             2095128414-3811769907-1077_1.rslc for Add Operation on Package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutral 
             _~_m042xdac27ax6.                             
2015-12-10 10:45:40  607   Deployment Add operation on package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutral_~_m042xdac27ax6 has been d 
             e-queued and is running for user XYZ\abc.                  
2015-12-10 10:45:40  613   Adding uri to the list of Uris: file:///C:/Users/abc/AppData/Local/Temp/TestApp/Test.App_1 
             .1.1.0_Test/Test.App_1.1.1.0_x86_x64_arm.appxbundle.                  
2015-12-10 10:45:40  614   Bundle Uri file:///C:/Users/abc/AppData/Local/Temp/TestApp/Test.App_1.1.1.0_Test/Artologik 
             .Kiosk_1.1.1.0_x86_x64_arm.appxbundle contains packages: "Test.App_1.1.1.0_x86.appx": 588388d0-5c5f-41e1-8965-f8ed6a2644.TestApp 
             _1.1.1.0_x86__m042xdac27ax6 "Test.App_1.1.1.0_x64.appx": 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_ 
             1.1.1.0_x64__m042xdac27ax6 "Test.App_1.1.1.0_ARM.appx": 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_arm__m0 
             42xdac27ax6.                              
2015-12-10 10:45:40  157   The app package signature was validated for core content of the app package published by CN=xxx. Payload won't be validated unt 
             il the files are read.                           
2015-12-10 10:45:40  170   The streaming reader was created successfully for app package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_x86__m04 
             2xdac27ax6.                              
2015-12-10 10:45:40  613   Adding uri to the list of Uris: file:///C:/Users/abc/AppData/Local/Temp/TestApp/Test.App_1 
             .1.1.0_Test/Test.App_1.1.1.0_x86_x64_arm.appxbundle\Test.App_1.1.1.0_x86.appx.          
2015-12-10 10:45:41  446   GetFullyQualifiedReference from the Main Resource Map for package full name: 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1 
             .1.1.0_x86__m042xdac27ax6 and reference string: Test.App failed.               
2015-12-10 10:45:41  446   GetFullyQualifiedReference from the Main Resource Map for package full name: 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1 
             .1.1.0_x86__m042xdac27ax6 and reference string: xxx failed.                  
2015-12-10 10:45:41  446   GetFullyQualifiedReference from the Main Resource Map for package full name: 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1 
             .1.1.0_x86__m042xdac27ax6 and reference string: Test.App failed.               
2015-12-10 10:45:41  446   GetFullyQualifiedReference from the Main Resource Map for package full name: 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1 
             .1.1.0_x86__m042xdac27ax6 and reference string: Test.App failed.               
2015-12-10 10:45:41  446   GetFullyQualifiedReference from the Main Resource Map for package full name: 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1 
             .1.1.0_x86__m042xdac27ax6 and reference string: default.html failed.                
2015-12-10 10:45:42  10000  About to service package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_x86__m042xdac27ax6. Setting the package state 
             to disabled returned with 0x80070490.                       
2015-12-10 10:45:42  827   Capability parsing started for the package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_x86__m042xdac27ax6   
2015-12-10 10:45:42  5060   error 0x80070005: Adding a tile failed with unexpected error.                  
2015-12-10 10:45:42  303   error 0x80070005: While preparing to process the request, the system failed to register the windows.visualElements extension due 
             to the following error: Access is denied.                       
             .                                 
2015-12-10 10:45:42  300   error 0x80070005: Cannot register the 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_m042xdac27ax6 package due to the followi 
             ng error: Access is denied.                           
             .                                 
2015-12-10 10:45:42  605   The last successful state reached was ResolvedDeferredRegistrations. Failure occurred before reaching the next state Registration 
             Changed.                               
2015-12-10 10:45:42  472   Moving package folder \\?\C:\Program Files\WindowsApps\588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutral_~_m042x 
             dac27ax6 to \\?\C:\Program Files\WindowsApps\Deleted\588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutral_~_m042xda 
             c27ax67380de84-c8fa-4c14-a532-e6f2a1242a48. Result: 0x0.                   
2015-12-10 10:45:42  472   Moving package folder \\?\C:\Program Files\WindowsApps\588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_x86__m042xdac27 
             ax6 to \\?\C:\Program Files\WindowsApps\Deleted\588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_x86__m042xdac27ax60605 
             8072-2034-461b-a9ba-a085b10152a7. Result: 0x0.                     
2015-12-10 10:45:42  10001  Finished servicing package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_x86__m042xdac27ax6. Setting the package sta 
             te to enabled returned with 0x0.                         
2015-12-10 10:45:42  401   Deployment Add operation with target volume C: on Package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutral_~_m0 
             42xdac27ax6 from: (Test.App_1.1.1.0_x86_x64_arm.appxbundle) failed with error 0x80073CF6. See http://go.microsoft.com/fw 
             link/?LinkId=235160 for help diagnosing app deployment issues.                 
2015-12-10 10:45:42  404   AppX Deployment operation failed for package 588388d0-5c5f-41e1-8965-f8ed6a2644.Test.App_1.1.1.0_neutral_~_m042xdac27ax6 w 
             ith error 0x80073CF6. The specific error text for this failure is: error 0x80070005: Adding a tile failed with unexpected error. 

Qualsiasi aiuto a tutti è molto apprezzato Voglio dire che! Qualsiasi, suggerimenti, soluzioni alternative, rituali pagani, cristalli, ...

+0

Gli errori "Accesso negato" si verificano al primo punto di errore. L'utente locale, che ha effettuato l'accesso e sta eseguendo lo script, dispone delle autorizzazioni complete per installare le applicazioni sul sistema? vale: non un utente limitato/locale? – gravity

+0

Nel mio caso, l'account che stavo usando aveva i permessi di amministratore. Ho provato a usare ProcMon per vedere da dove provenivano gli errori di accesso negato, ma tutto ciò che riuscivo a vedere erano le query per alcune chiavi di registro a cui l'account aveva diritti di accesso di controllo completo. – Shoaib

risposta

2

Stavo correndo nello stesso identico errore. Stavo cercando di installare su Cygwin SSH invece del servizio remoto di Powershell, ma sospetto che la causa principale sia simile.

Sono stato in grado di aggirare questo impostando un'attività pianificata che esegue uno script PowerShell in una posizione ben nota. (Ho fatto in modo che l'attività pianificata fosse eseguita con i massimi privilegi possibili, anche se non sono sicuro che sia necessario.) Potrei quindi impostare da remoto il contenuto di questo script PowerShell per eseguire lo script di installazione dell'app, quindi avviare l'operazione pianificata usando schtasks, che ha funzionato come un fascino.

+0

Io non sono l'OP ma ho fatto la taglia e quello che hai suggerito ha funzionato –

0

Quindi sì, come già indicato da Shoaib, l'operazione pianificata avrebbe funzionato. Si potrebbe anche provare ad avviare il processo remoto tramite WMI in questo modo:

Invoke-WmiMethod -Class win32_process -name Create -ComputerName dflt -Credential $cred -ArgumentList "powershell.exe -noprofile -noninteractive -executionpolicy bypass -encodedCommand 'your encoded command goes here'" 

si potrebbe anche provare ad avviare un altro processo PowerShell dall'interno della sessione PS (la fornitura di un altro credenziali degli utenti) e passando il comando a tale processo (molto simile a metodo WMI , ma da PSSession).

Hai già provato a richiamare semplicemente il comando sul computer remoto? potrebbe funzionare (anche se ne dubito).

È possibile utilizzare Configurazione stato desiderato per ottenere ciò che è necessario, ma è un po 'eccessivo (ma dovrebbe funzionare al 101%). Dovrebbe essere un provider di script per DSC.

0

Sono stato bloccato esattamente nello stesso problema per alcuni giorni. Dopo aver trovato questo thread e letto la risposta di Shoaib, ho iniziato a giocare con le attività programmate e finalmente ho scritto una sceneggiatura che funziona per me. Ho riscontrato molti problemi con le attività e Add-AppxPackage e mi sono reso conto che è necessario configurare l'attività con l'opzione "L'utente deve essere registrato" (mi dispiace, versione spagnola). Add-AppxPackage richiede che l'utente debba essere registrato su Works, il che forse spiega perché non funziona con Invoke-Command.

$adminUser = "[email protected]" 
$adminPass = "xxxxxxx" 

$pw = ConvertTo-SecureString -AsPlainText -Force -String $adminPass 
$cred = New-Object -Typename System.Management.Automation.PSCredential -ArgumentList $adminUser, $pw 

$command = "Add-AppxPackage -Path '\\path\App.appxbundle'" 
$bytes = [Text.Encoding]::Unicode.GetBytes($command) 
$encodedCommand = [Convert]::ToBase64String($bytes) 

$remoteUser = "[email protected]" 
$remoteComputer = "192.168.0.50" 

$taskName = "Task" 
$taskCommand = "powershell.exe" 
$taskArg = "-noprofile -noninteractive -windowstyle hidden -executionpolicy bypass -encodedCommand ""$encodedCommand""" 

$taskAction = New-ScheduledTaskAction -Execute $taskCommand -Argument $TaskArg 
$taskTrigger = New-ScheduledTaskTrigger -At 9am -Once 
$taskPrincipal = New-ScheduledTaskPrincipal -UserID $remoteUser -LogonType Interactive -RunLevel Highest 

$cimSession = New-CimSession -ComputerName $remoteComputer -Credential $cred -Authentication Negotiate 

Register-ScheduledTask -Action $taskAction -Trigger $tasktrigger -TaskName $taskName -Principal $taskPrincipal -CimSession $cimSession 

Start-ScheduledTask -CimSession $cimSession -TaskName $taskName 

Sleep 5 

Get-ScheduledTask -CimSession $cimSession | Where-Object {$_.TaskName -eq $taskName} | Unregister-ScheduledTask -CimSession $cimSession -Confirm:$false 
Problemi correlati