You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
557 B
26 lines
557 B
# Buka SSH shell ke NAS QNAP TS-932X |
|
# Usage: .\scripts\ssh-qnap.ps1 |
|
# .\scripts\ssh-qnap.ps1 -Command "df -h" |
|
|
|
param( |
|
[string]$Command = "" |
|
) |
|
|
|
$HostAddr = "10.100.1.10" |
|
$SshPort = 22 |
|
$SshUser = "admin" |
|
$IdentityFile = "$env:USERPROFILE\.ssh\id_ed25519" |
|
|
|
$sshArgs = @( |
|
"-i", $IdentityFile, |
|
"-o", "IdentitiesOnly=yes", |
|
"-o", "BatchMode=yes", |
|
"${SshUser}@${HostAddr}", |
|
"-p", $SshPort |
|
) |
|
|
|
if ($Command) { |
|
& ssh @sshArgs $Command |
|
} else { |
|
& ssh -i $IdentityFile -o IdentitiesOnly=yes "${SshUser}@${HostAddr}" -p $SshPort |
|
}
|
|
|