- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shutdown Script via SSH
Hello everyone,
i am writing a Powershellscript which shuts down some machines. One of these is a Fortigate.
So I establish a new SSH-Session and invoke the "execute Shutdown"-Command. But how can I confirm it with "y"?
Is there any "force"-command or something to work around the Shutdown-Confirmation?
When i do:
Invoke-SSHCommand -SessionId 0 -Command "execute shutdown"
Invoke-SSHCommand -SessionId 0 -Command "y"
it doesn't work.
Thanks a lot,
DoubleD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello DoubleD,
i have the same problem. How did you solve the issue?
Thank you in advance, Markus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Markus,
just try it with a SSHStream:
$SSHStream = New-SSHShellStream -Index 0
$SSHStream.WriteLine("execute shutdown") $SSHStream.Read()
regards,
Dominik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you look at adding the cmd option to set Confirm:$false in your script?
Ken Felix
PCNSE
NSE
StrongSwan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May better to use directly API (with PoweFGT !) need only to found the API call for shutdown device
