| Hi, I wonder, how i can make bolt to execute simple commands faster? Currently it takes 1 minute to execute the simplest command on a remote host with winrm. What would you recommend? Here i test varios connection methods:
| shell |
connection method |
execution time |
| cmd |
winrs |
1,468 |
| powershell |
winrs |
13,602 |
| powershell |
Invoke-Command |
16,23 |
| powershell |
bolt+winrm |
67,038 |
| cmd |
ssh |
1,268 |
| powershell |
ssh |
13,075 |
| cmd |
bolt+ssh |
47,106 |
| powershell |
bolt+ssh |
56,574 |
I test on a windows 10 laptop (xps15 2.2 GHZ, 16GB RAM) with a local vagrant vm (windows sever core 2019). Here is my code for illustration
PS C:\vagrant\windows2019-core> vagrant winrm -c 'echo "hi"' --shell cmd |
hi |
[00:10.920]PS C:\vagrant\windows2019-core> vagrant winrm -c 'Write-Host "hi"' --shell powershell |
hi |
[00:22.866] |
PS C:\vagrant\windows2019-core> windows2019-core -r:http://localhost:55985/wsman -u:vagrant -p:vagrant 'echo "hi"' |
"hi"[00:01.468]PS C:\vagrant\windows2019-core> winrs -r:http://localhost:55985/wsman -u:vagrant -p:vagrant 'powershell Write-Host " |
hi"' |
hi[00:13.602] |
PS C:\vagrant\windows2019-core> Invoke-Command ` |
>> -ComputerName localhost ` |
>> -Port 55985 ` |
>> -Credential $(` |
>> New-Object System.Management.Automation.PSCredential (` |
>> "vagrant", $(` |
>> ConvertTo-SecureString ` |
>> -String "vagrant" -AsPlainText -Force ` |
>> ) ` |
>> )` |
>> ) -ScriptBlock { Write-Host 'hi' } |
hi |
[00:16.230] |
PS C:\vagrant\windows2019-core> bolt command run "Write-Host 'hello'" --targets winrm://localhost:55985 --no-ssl --user vagrant --password vagrant --connect-timeout 20 |
Started on localhost... |
Finished on localhost: |
STDOUT: |
hello |
Successful on 1 target: localhost |
Ran on 1 target in 28.84 sec |
[01:07.038] |
PS C:\vagrant\windows2019-core> ssh -i C:/Users/igan/.vagrant.d/insecure_private_key vagrant@localhost -p2222 "echo 'hi'" |
'hi' |
[00:01.268]PS C:\vagrant\windows2019-core> ssh -i C:/Users/igan/.vagrant.d/insecure_private_key vagrant@localhost -p2222 "powershell Write-Host 'hi'" |
hi |
[00:13.075] |
|