Using the script mentioned in an earlier answer, I've rewrote it to improve it's usability. Save it as a powershell module (.psm1) to the system profile folder ($PsHome\Profile.ps1).
Then create a schedule task to run at the time you want to place the computer to sleep. In the actions tab set to the parameters you want.
Example:
Powershell -ExecutionPolicy Bypass -NoLogo -NonInteractive -Command "& {nap -PowerState Hibernate}"
function Suspend_Computer {
<#
.Synopsis
Sets the computer to a specified power mode.
.Description
The computer will be placed either in sleep or hibernation modes.
.Example
C:\PS>Suspend_Computer
Description
-----------
The command will run using default parameters which are not force the action of Suspend.
.Example
C:\PS>Suspend_Computer -Force $True -PowerState Hibernate
Description
-----------
The computer will save all data to disk and hibernate.
.Link
https://superuser.com/questions/505247/how-to-script-the-windows-7-sleep-command
#>
Param(
[Parameter(Mandatory =$False,Position=0)]
$Force = $False,
[Parameter(Mandatory=$False,Position=1)]
$DisableWake = $False,
[Parameter(Mandatory=$False,Position=2)]
[ValidateSet("Suspend","Hibernate")]
[string]$PowerState = 'Suspend'
)
Add-Type -AssemblyName System.Windows.Forms
$PowerState = [System.Windows.Forms.PowerState]::$PowerState;
[System.Windows.Forms.Application]::SetSuspendState($PowerState, $Force, $DisableWake);
}
new-alias -name nap -value Suspend_Computer