Stake key

First thing required is extracting the stake key hardware signing file (".hwsfile") and the stake key verification key (".vkey") from the hardware wallet. For this, the cardano-hw-cli binary file is required (
Create the following script as and save it in the keys folder, where the script is also stored:
cardano-hw-cli address key-gen \
--path 1852H/1815H/0H/2/0 \
--verification-key-file hw-stake.vkey \
--hw-signing-file hw-stake.hwsfile
#cardano-hw-cli address key-gen \
#--path 1852H/1815H/0H/0/0 \
#--verification-key-file hw-payment.vkey \
#--hw-signing-file hw-payment.hwsfile
Only the first command is required for the stake key, the second command is included as an example for extracting the hardware signing file for the first payment address of the hardware wallet.
The hw-stake.hwsfile file will be required for witnessing transactions with the hardware wallet, and the hw-stake.vkey file will be required when creating the new stake pool registration certificate.
The script must be executed with the hardware wallet connected to the computer and unlocked, and with the Cardano application started. It will be required to confirm the key export on the hardware wallet.