Unsolved
This post is more than 5 years old
1 Message
0
25912
Recurring Scheduling (shut down, WOL)
Recurring Scheduling (shut down, WOL)
Hi, I wonder if someone could help me.
I am working with a client who has requested that all their WYSE C10LE's Wake-On-Lan at a specific time on a morning and shut down on an evening.
After reading the documentation for WDM I am sure this is do-able just can't figure out how.
Thanks in advance for any assistance.
Karl
jmaurer
7 Posts
0
June 2nd, 2015 09:00
This is not possible to do in 4.8.5, but this feature is in 4.9 which will be coming out soon.
JannieH
1 Message
1
June 15th, 2015 05:00
Can't help with the shutdown portion, but for what it's worth I was in a predicament where I could also not use the WoL functionality in WDM (reliably); the following PowerShell script I cobbled together from various sources might be useful. It queries the WDM database for a list of devices, then sends WoL packets to all of them. No external executables required. You should be able to schedule this with Windows Task Scheduler.
Note that the script assumes that the machine you run it from (probably the WDM server) is on the same subnet as the terminals. It should be possible to change this with minor adjustments to the script. As stated, this is classic copy-and-paste PowerShell, so I don't profess to have the skills to be able to make those kinds of changes if required - go steal some bits from a web search yourself! :-)
#----------
#Script to query the Wyse Device Manager Database for a list of managed MAC addresses and send WoL packets to all of them
#Some Query Parameters
$SqlServer = "localhost\RAPPORTDB"
$SqlCatalog = "RapportDB"
$SqlUser = "sa"
$SqlPassword = "ThinMgmt_451"
$SqlQuery = "select MAC from View_ClientDetails"
#UDP Connection Setup
$UdpClient=New-Object System.Net.Sockets.UdpClient
$UdpClient.Connect(([System.Net.IPAddress]::Broadcast),16962)
#SQL Connection Setup & Execution
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SqlServer; Database = $SqlCatalog; User Id=$SqlUser; Password=$SqlPassword"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
#Loop through the data set returned by the SQL Query, generate a Magic Packet for each MAC and transmit it
foreach ($Row in $DataSet.Tables[0].Rows)
{
#Convert MAC Address to a byte array of binary values
$Mac=@($($Row[0]) -split '([a-f0-9]{2})' | foreach-object { if ($_) {[System.Convert]::ToByte($_,16)}})
#Construct Magic Packet data payload
$Packet = [Byte[]](,0xFF*6)+($Mac*16)
#Transmit the Magic Packet
[Void]$UdpClient.Send($Packet,$Packet.Length)
}
#UDP Connection Cleanup
$UdpClient.Close()
#----------