How to Schedule Tasks from Command Line Windows 10/11

How to schedule a reboot or shutdown daily at a certain time using command line.  Applies to Windows 10/11

Below is an example of scheduling a shut down of a computer, daily at 6PM.

schtasks /create /sc daily /tn ShutdownAt6PM /tr “shutdown -s -f -t 2” /st 18:00 /NP

schtasks, command to schedule tasks.  the AT command that used to be with earlier versions of Windows has been deprecated

/create, To create a new task

/sc, to schedule frequency.  like once or daily.

/tn, name of the task.  this is a description

/tr, this is the command to schedule like “Shutdown -s -f -t 2”. -s to shutdown, -f to force shutdown, -t 2 to delay by 2 seconds.  The -s can be replaced by -r to reboot instead of shutdown.

/st, this is the time to execute the command.

/NP to run the schedule account on the Windows computers regardless whether the user is logged in or not.

How to Extract Private Key and SSL Certificate from a Certificate.pfx file


If you have an SSL certificate in pfx format (also called PKCS#12 format) and that usually includes the SSL certificate for your host or domain along with the private key (usually the key is secured with a password), and if you want to extract the certificate file and the private key, here what you can do

Assuming the name of the certificate is MyCertificate.pfx

1- download/Install/extract OpenSSL command line utility into a temp folder.

2- Copy the the MyCertificate.pfx certificate file into that folder.

3- To export the ssl certificate into pem format

openssl  pkcs12  -in  MyCertificate.pfx  -nokeys  -out  MyCertificate.pem

4- To export private key:
openssl  pkcs12  -in MyCertificate.pfx  -nocerts  -out  MyPrivateKey.pem  -nodes

5- To remove the passphrase/password from the private key:
openssl rsa  -in  MyPrivateKey.pem  -out   NewPrivateKey.key

Now you have you have the certificate MyCerificate.pem & the private key NewPrivateKey.key (the names here could be anything – you can name them or rename them to anything descriptive or to whatever your webserver/web application documentation requires).


My notes on Halo (unrelated to the above)

Open the “cert” on the servers desktop, backup the current certificate and private key and move them out.  Copy the new cert and private key and match the names to backup files..

Restart Halo services.