You can use Python to power off a Junos device from a Windows PC.
1. Install Python (Refer to PYEZ cookbook, link at the bootom)
2. Install Junos PYEZ library on Windows PC. (Refer to PYEZ cookbook, link at the bootom)
3. Open PowerShell and run the following commands, you can use the same in a Python script as well
4. Ensure netconf over ssh is enabled on EX device
> show configuration system services netconf ssh;
>> Script Code exec in Python interpreter
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\jnet> python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jnpr.junos
>>> from jnpr.junos import Device
>>> from jnpr.junos.exception import ConnectError
>>> srx=Device(host='<IP address of host>',user='root',password='password') << non-root should work if it has permissions.
>>> from jnpr.junos.utils.sw import SW
Feb 24 20:24:58 jlaunchd: database-replication (PID 90347) terminate signal 15 sent
Feb 24 20:24:59 jlaunchd: ethernet-connectivity-fault-management (PID 90348) terminate signal 15 sent
Feb 24 20:24:59 jlaunchd: stats-agent (PID 90349) terminate signal 15 sent
Feb 24 20:25:00 jlaunchd: transport-control (PID 90350) terminate signal 15 sent
Feb 24 20:25:00 jlaunchd: SDN-Telemetry (PID 90353) terminate signal 15 sent
Feb 24 20:25:00 jlaunchd: routing (PID 90354) terminate signal 15 sent
Feb 24 20:25:01 jlaunchd: firewall (PID 90355) terminate signal 15 sent
Feb 24 20:25:01 jlaunchd: chassis-control (PID 90356) terminate signal 15 sent
Feb 24 20:25:01 jlaunchd: alarm-management (PID 90358) terminate signal 15 sent
Feb 24 20:25:05 jlaunchd: craft-control (PID 18017) exited with status=0 Normal Exit
Waiting (max 60 seconds) for system process `vnlru' to stop...done
Waiting (max 60 seconds) for system process `bufdaemon' to stop...done
Waiting (max 60 seconds) for system process `syncer' to stop...
Syncing disks, vnodes remaining...0 0 0 0 done
All buffers synced.
besw0: 4 Broadcom SDK kernel threads killed
Khelp module "jsocket" can't unload until its refcount drops from 5 to 0.
The operating system has halted.
Turning the system power off.
>> Running as Script
from jnpr.junos import Device
from jnpr.junos.exception import ConnectError
ex=Device(host='<IP address of host>',user='root',password='password')
from jnpr.junos.utils.sw import SW
Which version of Junos Space are you using? Also a few additional questions, how many devices would you expect to reboot? All at the same time, or scheduled to reboot at some defined time? Would you need to be able to cancel a scheduled reboot etc.
If you are running a suitable version of Junos Space (I'm guessing 14.x or higher), then this functionality is available within the standard Network Management Platform. No need to install anything else, unless the default functionality isn't sufficient.
In Space 19.1 for example you can navigate to the Device Management view, select the devices that you wish to reboot, and then select Actions, Device Operations, Reboot devices. This gives you some limited options to schedule the task for a specific time, include a message, or alternatively power off the device(s).
This functionality might be sufficient for your needs, however if it isn't for example with a multi RE device you want to reboot a specific routing engine rather than both RE's, you can't do that with the built-in functionality of Junos Space. However, you can implement the functionality in Junos Space using SLAX scripts. Note that I say SLAX scripts and not CLI Configlets, because CLI Configlets can only push/modify/delete configuration on devices, they are not able to make RPC calls to a device or Junos Space for that matter to go and execute some set of tasks. Whereas SLAX scripts can perform exactly that process.
In the past I've written SLAX scripts to include reboot and halt functionality for dual RE devices, so if you need any pointers on that I can share those scripts, but for basic reboot functionality Junos Space should be able to provide this functionality out of the box with a suitable version of the product.