n-Archives.net

nWOLc Manual : Console Command for nWOL

Table of Contents

Overview of nWOLc

nWOLc.exe is a console command for nWOL. You can send magic packets, check host status, and wait for a host to boot up using this command.

It is bundled with the nWOL package, and when you use installer, it will be placed in the same folder as nWOL (C:\Program Files\nWOL).

This command can be manually executed from command prompt window, and also can be executed from a batch file or task scheduler.

 

Options of nWOLc.exe are as follows.

nWOLc: nWOL console command   (Version 1.7.55)

-l ["regex"]           List all or regex-matched hosts
-a                     Send magic packet to all WOL-capable hosts
-h hostnames...        Send magic packet to specified WOL-capable hosts
-r "regex"             Send magic packet to regex-matched WOL-capable hosts
-m mac [ip [mask]]     Send magic packet
-p hostname            Check status of a host(or IP) (retcode=0 when online)
-w hostname [waitsec]  Wait for a host(or IP) to come online (retcode=0 when online)
-t sec                 Set ping timeout in seconds for -p or -w (default=1)
-i                     Ignore case when -l or -r
-c filename            Configuration file name(Absolute path or User name)
-o filename            Redirect console output to a file(Absolute path)
-v                     Verbose mode
-n                     No output messages
-?                     Help

 

Options

-l ["regex"]  : List hosts

List hosts registered in nWOL.

Example Description
nwolc -l
List all hosts registered in nWOL.
nwolc -l ^a.*z$
List hosts which match the regex. (ex. bigins with 'a' and ends with 'z')
nwolc -l server -i
List hosts which match the regex. (ex. contains the string 'server' ignoring case)

 

-a  : Send magic packet to all hosts

Send magic packets to all WOL-capable hosts registered in nWOL.

Example Description
nwolc -a
Send magic packets to all WOL-capable hosts registered in nWOL.

 

-h hostnames...  : Send magic packet to the specified hosts

Send magic packet to specified WOL-capable hosts registered in nWOL.

  • If a host name contains spaces, enclose it with " ".
  • Use space to list multiple host names.
  • It is case-sensitive, by default.
Example Description
nwolc -h Server1 "File Server"
Send magic packet to Server1 and "File Server"

 

-r "regex"  : Send magic packet to regex-matched hosts

Send magic packet to specified WOL-capable and regex-matched hosts registered in nWOL.

Example Description
nwolc -r ^[0-9]
Send magic packet to all hosts which names start with decimal digit.
nwolc -r PC$ -i
Send magic packet to all hosts which names end with "PC", ignoring case.

 

-m mac [ip [mask]]  : Send magic packet

Send magic packet to specified MAC address with optional IP address and netmask.

  • If the remote host is in the same LAN, only MAC address is required.
  • If the remote host is outside LAN, MAC address, IP address and Netmask are all required.
  • You can send magic packet directly to "directed broadcast address" for the remote host, without netmask.
  • If you want to know details about the behavior of nWOLc when IP address and netmask is omitted, please see "nWOL's behavior when the IP address is unknown".
  • If your PC has multiple NICs, and when IP address is omitted, magic packet will be sent out from all the network interfaces.
  • DNS name can be used for the IP address.
  • The order of IP address resolution is:
    (1) Try to parse as IP address format (ex. 192.168.1.10)
    (2) Try DNS resolution
  • When DNS resolution, DNS suffix list specified in the nWOL settings will be used.
Example Description
nwolc -m abcdef123456
Send magic packet to the host(MAC address: abcdef123456) which is in the same LAN.
nwolc -m abcdef123456 192.168.1.20
Send magic packet to the host(MAC address: abcdef123456, IP address:192.168.1.20) which is in the same LAN.
nwolc -m abcdef123456 192.168.10.20 255.255.255.0
nwolc -m abcdef123456 192.168.10.20 24
nwolc -m abcdef123456 192.168.10.20/24
Send magic packet to the host(MAC address: abcdef123456, IP address:192.168.1.20, Netmask:/24).
nwolc -m abcdef123456 192.168.10.255
Send magic packet to the host(MAC address: abcdef123456). Destination IP address of the magic packet is 192.168.10.255 which is a "directed broadcast address" of the remote host.
nwolc -m abcdef123456 mypc.mydomain.com
Send magic packet to mypc.mydomain.com. The name will be resolved by DNS.
nwolc -m abcdef123456 mypc.mydomain.com 24
Send magic packet to mypc.mydomain.com. The name will be resolved by DNS, and 24 bit netmask will be applied for the destination IP address.

 

-p hostname  : Check the status of a host

Check the status of a host by sending ping packet.

Example Description
nwolc -p Server1
Check the status of Server1
nwolc -p 192.168.1.6
Check the status of the host which address is 192.168.1.6.
nwolc -p mypc.mydomain.com
Check the status of the host of mypc.mydomain.com.
nwolc -p Server1 -t 3
Check the status of Server1 with 3 seconds ping timeout.
  • Return value will be 0, if the host is online. Otherwise, 1.
  • Default timeout of ping is 1 second.
  • The order of IP address resolution is:
    (1) Search the host name in the nWOL settings.
    (2) Try to parse as IP address format (ex. 192.168.1.10)
    (3) Try DNS resolution
  • When DNS resolution, DNS suffix list specified in the nWOL settings will be used.

 

Notes: In the case of the Windows ping command, the return value is 0 (normal) even if the destination is unreachable (no route to the destination address). On the other hand, nwolc -p returns 1 in all cases except when it received the response from the host successfully.

 

-w hostname [waitsec]  : Wait until a host becomes online

Wait until a host becomes online. This command will repeatedly send ping to the host until a successful response is received. If waitsec is specified, the command exits when the host does not become online for waitsec seconds. If waitsec is not specified, the command never terminate.

  • Return value will be 0, if the host becomes online. Otherwise, 1, including the case waitsec expires.
  • -w can be used together with one of send magic packet options (-a, -h or -r). In that case, after sending the magic packet, it will wait until the specified host becomes online. Return value will be the return value of -w, regardless of the result of sending magic packet (-a, -h or -r).
  • The order of IP address resolution is:
    (1) Search the host name in the nWOL settings.
    (2) Try to parse as IP address format (ex. 192.168.1.10)
    (3) Try DNS resolution
  • When DNS resolution, DNS suffix list specified in the nWOL settings will be used.
Example Description
nwolc -w Server1 60
Wait until Server1 becomes online maximum 60 seconds.
nwolc -w Server1
Wait until Server1 becomes online with no time out.
nwolc -w 192.168.1.6 60
Wait until the host 192.168.1.6 becomes online maximum 60 seconds.
nwolc -w 192.168.1.6 60 -t 3
Wait until the host 192.168.1.6 becomes online maximum 60 seconds, setting 3 seconds timeout for ping.
nwolc -w mypc.mydomain.com 60
Wait until mypc.mydomain.com becomes online maximum 60 seconds.
nwolc -h Server1 -w Server1 60
Send magic packet to Server1, then wait until Server1 becomes online maximum 60 seconds.
nwolc -a -w Server1
Send magic packet to all WOL-capable hosts, then wait until Server1 becomes online with no time out.

 

-t sec  : Set timeout seconds for ping

Set timeout seconds for ping. This has to be used with -p or -w.

  • Default timeout value is 1 seconds.
  • Usually, you do not need to change this value.
Example Description
nwolc -p Server1 -t 3
Check the status of Server1 with 3 seconds timeout for ping.

 

-i  : Ignore Case

Use case-insensitive for regular expression matching.

 

-c filename  : Specify nWOL configuration file

Specify the nWOL configuration file. This has to be an absolute path for the file or just user name.

When user name is specified, the path will be C:\Users\<user name>\AppData\Roaming\nWOL\nWOL.conf .

Specified file must have a right permission.

Example Description
nwolc -c "c:\Users\My Name\AppData\
Roaming\nWOL\nWOL.conf" -l
Load specified file as a nWOL configuration file, then run -l.
nwolc -c "User Name" -l
Load the "User Name"'s nWOL configuration file, then run -l.

 

-o filename  : redirect console output to a file

Redirect console output to a file. filename has to be an absolute path. If the file exists, output will be appended to the file.

Example Description
nwolc -o "c:\Windows\Temp\out.log" -l
Run -l. console output will be appended to the specified file.

 

-v  : Verbose mode

Generate more detailed messages.

 

-n  : Suppress messages

Do not generate any console output.

 

-?  : Help

Show help, brief explanations of nWOLc options. The same message can be shown when executing nWOLc with no option.

 

Return Value

Basically, nWOLc returns 0, when normal. Otherwise, when any Error messages occured, nWOLc returns 1.

In case of -p -w, nWOL returns 0 if the host becomes online, otherwise, returns 1.

In the case -w is used with one of -a, -h or -r, nWOLc returns the return value of -w, even if there's any error messages during the process of sending magic packet.

 

-m, -p, -w can be used without nWOL configuration

nWOLc.exe basically depends on the configurations of nWOL. However, -m, -p and -w can be used without nWOL configuration. You can run nWOLc with -m -p or -w independently from nWOL.

 

Specification of regular expressions used in nWOL and nWOLc

Please refer to the page below for the specification of the regular expression used in nWOL and nWOLc.

 

 

Related Articles

 

Submit your comment
Name:
Comment:
Submission type:



Submitted comments will be processed manually. So, please understand it will take about a day to publish your comment.