Question [Résolu] Export-WindowsDriver sous Seven

Plus d'informations
il y a 7 ans 7 mois #27434 par Laurent Dardenne
Configure l'exécution de code à l'aide du cmdlet Set-ExecutionPolicy.

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 7 mois #27436 par viscuso
Réponse de viscuso sur le sujet Re:Export-WindowsDriver sous Seven
Merci ;)

J'ai utilisé cette page :

www.it-connect.fr/autoriser-lexecution-de-scripts-powershell/

J'ai progressé jusqu'à cette erreur :

[code:1]
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> Get-ExecutionPolicy
Restricted
PS C:\Windows\system32> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the
about_Execution_Policies help topic at go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All Suspend [?] Help (default is \"N\"«»): A
PS C:\Windows\system32> Import-Module \"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\dism.psd1\"
PS C:\Windows\system32> Export-WindowsDriver -Destination \"C:«»Drivers$((Get-WmiObject -Class win32_computersystem).Model)\" -Online
Export-WindowsDriver : DismInitialize failed. Error code = 0x8007007e
At line:1 char:1
+ Export-WindowsDriver -Destination \"C:«»Drivers$((Get-WmiObject -Class w ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:«») [Export-WindowsDriver], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.ExportWindowsDriverCommand

PS C:\Windows\system32>
[/code:1]

J'ai un Seven Service Pack 1 de 2009 64 bits<br><br>Message édité par: kaleo, à: 23/08/18 21:02

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 6 mois #27438 par Laurent Dardenne
Les codes erreur du type 0x8007007e sont, si je ne me trompes pas lié à COM.
Peux-tu rechercher sur le net (blog de la team Powershell) la fonction resolve-error et nous donner le résultat qu'elle renvoie pour cette erreur.
Ex:
[code:1]
call truc
resolve-erreur
[/code:1]

Tu peux aussi rechercher sur le net le code d'erreur avec le nom du module utilisé.

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 6 mois #27439 par viscuso
Réponse de viscuso sur le sujet Re:Export-WindowsDriver sous Seven
J'ai trouvé cette page :

blogs.msdn.microsoft.com/powershell/2006/12/07/resolve-error/

Mais j'ai utilisé le Resolve-Error.ps1 présent dans :

ottomatt.pagesperso-orange.fr/Data/Tutor...werShell/Sources.zip

;)

cependant je ne sais pas m'en servir.

J'ai ceci comme retour :

[code:1]
PS C:\Users\inlean\Desktop\powershell\Sources&gt; dir


Directory: C:\Users\inlean\Desktop\powershell\Sources


Mode LastWriteTime Length Name
----

----
d
15/08/2013 19:22 logs
d
01/09/2018 00:32 Sources
-a---- 07/03/2012 20:18 4608 ErrorOut.exe
-a---- 15/08/2013 17:59 5131 Invoke-CommandStopOnAllErrors.ps1
-a---- 03/09/2013 21:58 4600 Invoke-CommandWithUnhandledExceptions.ps1
-a---- 23/05/2009 10:45 450706 LaNotionDobjetSousPowerShell.pdf
-a---- 30/07/2013 12:07 701 New-Exception.ps1
-a---- 15/08/2013 18:51 2310 New-ExceptionClass.ps1
-a---- 07/07/2013 12:44 675 Program.cs
-a---- 07/07/2013 12:45 3584 Program.exe
-a---- 07/07/2013 12:44 663 Program2.cs
-a---- 07/07/2013 12:45 3584 Program2.exe
-a---- 23/06/2013 13:56 2044 PSv3-Test-Redirection.ps1
-a---- 06/12/2011 20:38 66232 Replace-String.ps1
-a---- 23/06/2013 15:04 495 Resolve-Error.ps1
-a---- 15/08/2013 18:20 1157 Test-InvokeCommandWithUnhandledExceptions.ps1


PS C:\Users\inlean\Desktop\powershell\Sources&gt; cat Resolve-Error.ps1
function Resolve-Error($ErrorRecord=$Error[0])
{ #Affiche toutes les informations de la dernière erreur rencontrée
#http://blogs.msdn.com/powershell/archive/2006/12/07/resolve-error.aspx
$ErrorRecord | Format-List * -Force
$ErrorRecord.InvocationInfo |Format-List *
$Exception = $ErrorRecord.Exception
for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
{ \&quot;$i\&quot; * 80
$Exception |Format-List * -Force
}
}
Set-Alias rver Resolve-Error
PS C:\Users\inlean\Desktop\powershell\Sources&gt; .\Resolve-Error.ps1
PS C:\Users\inlean\Desktop\powershell\Sources&gt; Import-Module \&quot;C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\dism.psd1\&quot;
PS C:\Users\inlean\Desktop\powershell\Sources&gt; Export-WindowsDriver -Destination \&quot;C:«»Drivers$((Get-WmiObject -Class win32_computersystem).Model)\&quot; -Online
Export-WindowsDriver : DismInitialize failed. Error code = 0x8007007e
At line:1 char:1
+ Export-WindowsDriver -Destination \&quot;C:«»Drivers$((Get-WmiObject -Class w ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:«») [Export-WindowsDriver], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.ExportWindowsDriverCommand
[/code:1]

[code:1]
PS C:\Users\inlean\Desktop\powershell\Sources&gt; call 0x8007007e
call : The term 'call' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ call 0x8007007e
+ ~~~~
+ CategoryInfo : ObjectNotFound: (call:«»String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\inlean\Desktop\powershell\Sources&gt;
[/code:1]

[code:1]
PS C:\Users\inlean\Desktop\powershell\Sources&gt; .\Resolve-Error.ps1 0x8007007e
PS C:\Users\inlean\Desktop\powershell\Sources&gt; Export-WindowsDriver -Destination \&quot;C:«»Drivers$((Get-WmiObject -Class win32_computersystem).Model)\&quot; -Online
Export-WindowsDriver : DismInitialize failed. Error code = 0x8007007e
At line:1 char:1
+ Export-WindowsDriver -Destination \&quot;C:«»Drivers$((Get-WmiObject -Class w ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:«») [Export-WindowsDriver], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.ExportWindowsDriverCommand
[/code:1]
[code:1]
PS C:\Users\inlean\Desktop\powershell\Sources&gt; .\Resolve-Error.ps1 0x8007007e
PS C:\Users\inlean\Desktop\powershell\Sources&gt;
[/code:1]

Il me semble que ceci pourrait compléter la fonction \&quot;Resolve-Error\&quot; :

stackoverrun.com/fr/q/6266125

[code:1]
try {
$download.DownloadFile($sourceFile, $destinationFile)
}
catch [System.Net.WebException] {
if ($_.Exception.InnerException) {
Write-Error $_.Exception.InnerException.Message
} else {
Write-Error $_.Exception.Message
}
}
[/code:1]
Mais je ne sais pas le faire :laugh:<br><br>Message édité par: kaleo, à: 25/08/18 15:16

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 6 mois #27440 par Laurent Dardenne
Par défaut la fonction Resolve-Error affiche la dernière erreur.Elle affiche le contenu d'une Erreur sur plusieurs 'niveau' (une erreur peut contenir une autre erreur).

L'appel de Resolve-Error sans paramètre est équivalent à Resolve-error $Error[0]

$Error contient la liste des erreurs, la première est à l'indice 0, la précédente à l'indice 1.

Dans ton cas exécute ta commande ou ton script et exécute dans la foulée Resolve-Error sans paramètre.

Puis communique nous le résultat renvoyé.

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 6 mois #27441 par viscuso
Réponse de viscuso sur le sujet Re:Export-WindowsDriver sous Seven
J'ai ceci :

[code:1]
PS C:\Users\inlean\Desktop\powershell\Sources&gt; Import-Module \&quot;C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\dism.psd1\&quot;
PS C:\Users\inlean\Desktop\powershell\Sources&gt; Export-WindowsDriver -Destination \&quot;C:«»Drivers$((Get-WmiObject -Class win32_computersystem).Model)\&quot; -Online
Export-WindowsDriver : DismInitialize failed. Error code = 0x8007007e
At line:1 char:1
+ Export-WindowsDriver -Destination \&quot;C:«»Drivers$((Get-WmiObject -Class w ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:«») [Export-WindowsDriver], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.ExportWindowsDriverCommand

PS C:\Users\inlean\Desktop\powershell\Sources&gt; .\Resolve-Error.ps1
PS C:\Users\inlean\Desktop\powershell\Sources&gt;

[/code:1]

Copie de la fenêtre powershell :

www.casimages.com/i/180825062450439507.png.html

Message édité par: kaleo, à: 25/08/18 17:12

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.046 secondes
Propulsé par Kunena