Page 1 sur 1

[R] _RunDos ne marche plus avec Powershell

Posté : mar. 02 avr. 2019 18:14
par Boulanza
Bonjour,
Je vous prie de m'aider à formuler le code suivant pour qu'il s’exécute correctement avec Powershell :
 Local $Powershell = @SystemDir&"\WindowsPowerShell\v1.0\powershell.exe"
 Local $program = 'signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "c:\path\to\mycert.pfx" /p pfxpassword "c:\path\to\file.exe"'
 ShellExecuteWait($Powershell,$program, "", "", @SW_HIDE)
Merci d'avence pour votre aide.

Re: [..] _RunDos ne marche plus avec Powershell

Posté : mar. 02 avr. 2019 22:04
par Boulanza
Bonsoir,
Depuis que PowerShell remplace l’invite de commandes « cmd.exe », les codes qui utilisent _RunDos ne marchent plus ! ? Le Le code suivant marche sans souci avec l’invite de commandes PowerShell.
C:\Windows\system32> signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "c:\path\to\mycert.pfx" /p pfxpassword "c:\path\to\file.exe
J'ai utilisé plusieurs méthodes pour le coder en utilisant ShellExecuteWait mais le code ne réagit pas voici le code:
;Local $program = 'signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f "c:\path\to\mycert.pfx" /p pfxpassword "c:\path\to\file.exe"'
Func SigneFilesha256_01()      ; Sous $Powershell
Local $Powershell = @SystemDir&"\WindowsPowerShell\v1.0\powershell.exe"
Local $program = 'signtool'
Local $Option1= 'sign /tr'
Local $URL = 'http://timestamp.digicert.com'
Local $Option2 = '/td sha256 /fd sha256 /f'
Local $fileCA = "c:\path\to\mycert.pfx"
Local $Pass = '/p pfxpassword'
Local $File = "c:\path\to\file.exe"
Local $Sign = $program&" "&$Option1&" "&$URL&" "&$Option2&" "&$fileCA&" "&$Pass&" "&$File
;MsgBox(64,"test", $Sign)
ShellExecuteWait($Powershell,$Sign, "", "", @SW_HIDE)
EndFunc
je vous prie de m'aider à coder signtool
Cordialement.

Re: [..] _RunDos ne marche plus avec Powershell

Posté : mer. 03 avr. 2019 12:23
par Boulanza
Le problème est lié à l’exécution de WindowsPowerShell en tant qu'administrateur sous Windows 10. La solution :
Start-Process powershell -Verb runas

Re: [R] _RunDos ne marche plus avec Powershell

Posté : mer. 10 avr. 2019 18:11
par Boulanza
Bonjour,
Effectivement, depuis que PowerShell remplace l’invite de commandes « cmd.exe », les codes qui utilisent _RunDos de AutoIt ne marchent plus ! sous Windows 10 ? Voici la solution avec l’invite de commandes PowerShell :
ShellExecuteWait(@SystemDir&"\WindowsPowerShell\v1.0\powershell.exe")
ça marche pour moi, à vous de vérifier.
Cordialement.

Re: [R] _RunDos ne marche plus avec Powershell

Posté : mer. 10 avr. 2019 22:30
par Tlem
PowerShell ne remplace pas encore l'invite de commandes "cmd.exe". Peut-être un jour, mais surement pas de suite ...

Et contrairement à ce que vous avancez,_RunDos fonctionne toujours sur Windows 10 ! Pour vous en convaincre, essayez l'exemple de la documentation.

Re: [R] _RunDos ne marche plus avec Powershell

Posté : mer. 10 avr. 2019 22:39
par Boulanza
Bonsoir monsieur Tlem,
Merci pour ces précisions.
Cordialement.