1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wake on Lan

Discussion in 'Software' started by SimonV, Nov 26, 2003.

  1. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Does anybody know of some really simple wake on lan "Freeware" that I can download. I've found a couple that are for sale but I'd prefer something thats free.

    Oh, and I'm also after a piece of script that I can use for the same job and to shutdown also.

    Any ideas? I did try taking a look yesterday but I just dont seem to have enough time at the mo to nail this down.

    Si
    :D
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  2. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,412
    3
    82
    Here's some info on scripting to do this, might be helpful

    http://www.winnetmag.com/WindowsScripting/Article/ArticleID/20508/20508.html

    This page also has a link to a copy of the code for such a script, and a link at the top of the page to download it.

    Heres A link to download a freeware copy of WOL.exe

    http://www.gammadyne.com/cmdline.htm#wol

    HTH :D
     
    Certifications: A+, 70-210, 70-290, 70-291
    WIP: 70-294
  3. Nelix
    Honorary Member

    Nelix Gigabyte Poster

    1,412
    3
    82
    27 minutes to reply and that includes a little bit of searching the net........not bad Eh?? :?: :whatthink
     
    Certifications: A+, 70-210, 70-290, 70-291
    WIP: 70-294
  4. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Cheers Nelix, I'll try take a look later.

    Si
    :D
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  5. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    you could also take a look at

    http://cwashington.netreach.net/depo/view.asp?Index=880&ScriptType=vbscript

    which has a short script to wake up a range of machines based on a text file of mac addresses you supply. It uses ultrawol which you can get here:

    http://www3.sympatico.ca/manukian/

    as for shutting down a machine you could try this bit of code

    [code:1:efd52e199a]
    Set objArgs = WScript.Arguments
    For Each strArg in objArgs
    strSystem = "Your computer name or IP address here"
    next
    Set OpSysSet=GetObject("winmgmts:{(Debug,RemoteShutdown)}//" & strsystem & "/root/cimv2").ExecQuery("Select * from Win32_OperatingSystem where Primary=true")
    for each OpSys in OpSysSet
    OpSys.Win32Shutdown(8)
    next
    [/code:1:efd52e199a]

    Place that bit of code in vbs file and change the strarg variable to contain you computer name or IP address.
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  6. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Cheers Phil, looks like the knid of thing I'm after. Will let you know how I get on.

    Si
    :D
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  7. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Phil,

    You anygood with this app, I could do with a liitle help. I have a list of MAC adresses that I want to use this with. From what I'm reading I need to create a txt file with them in called maclist.txt.

    It says
    so do I need one per line using the above format 00-0a-13-b4-c5-10 as mine are without the -

    Then do I need to overwrite the UltraWOL vbs file with the script from http://cwashington.netreach.net/depo/view.asp?Index=880&ScriptType=vbscript

    OR

    can you think of a better way to do this. The reason is I want the teacher to be able to double click an icon/file on the thier desktop to startup or shutdown a room of PC's as they just cant be bothered at the end of the day and leave them on all day, night and weekend.

    SimonV
     
    Last edited: Jan 2, 2015
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  8. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    Si,

    I didn't use the win32scripting script modified the ultrawol script, the following is a cut and shut job of their and my script which should work for you

    [code:1:96b45b20be]
    complist =".\maclist.txt"

    Dim oFSO, objTextFile, objwol
    Const ForReading = 1
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
    set objWOL = Wscript.CreateObject("UltraWOL.ctlUltraWOL", "objWOL_")
    Set objTextFile = oFSO.OpenTextFile(complist, ForReading)


    Do While objTextFile.AtEndOfStream <> True

    strSystem = objTextFile.Readline

    if IsObject(objWOL) then
    objWOL.BroadcastAddr = "255.255.255.255"
    objWOL.MACAddr = strsystem
    objWOL.WakeUp
    else
    msgbox "Error initializing control.", vbCritical
    end if

    Loop

    wscript.echo "WOL Broadcast complete"

    set objwol = nothing
    [/code:1:96b45b20be]

    If you put all that code in a text file and rename the extension with .vbs then give it a whirl. Put all the mac addresses in maclist.txt in the same directory as the vbs, each address should be on a separate line, do a search and replace for : to - and you should be laughing. You could use a similar method to shut down the PC's only placing the ip addresses in a file, if you'd like a hand with that just give us a shout.
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  9. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Cheers Phil, I'll give it a go tommorow and let you know.

    Si :thumbleft
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  10. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    Si,

    Here's a modified version of the shutdown code, it takes a text file called shutlist.txt just put either ip addresses or computer names in it one to a line and it should shut down the machines. One thing to note, if a computer is locked it won't shut it down.

    [code:1:491f8c5079]
    complist =".\shutlist.txt"

    Dim oFSO, objTextFile
    Const ForReading = 1
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
    Set objTextFile = oFSO.OpenTextFile(complist, ForReading)


    Do While objTextFile.AtEndOfStream <> True

    strSystem = objTextFile.Readline

    Set OpSysSet=GetObject("winmgmts:{(Debug,RemoteShutdown)}//" & _
    strsystem & "/root/cimv2").ExecQuery("Select * from _
    Win32_OperatingSystem where Primary=true")
    for each OpSys in OpSysSet
    OpSys.Win32Shutdown(8)
    next


    Loop

    wscript.echo "Shutdown Broadcast complete"
    [/code:1:491f8c5079]
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  11. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Nice one Phil, I'll have a go later today. I can see a few expert points coming your way. :thumbleft

    Si
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  12. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Phil, Nice work on the WOL script that works a treat thanks.

    But the shutdown script gives me an error:
    [code:1:4ae64372b7]Line:14
    Char: 55
    Error: Unterminated string constant
    Code: 800A0409
    Source: Microsoft VBScript compilation error[/code:1:4ae64372b7]

    I'm guessing this means that a quote " is missing or something?

    Si
    :D
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  13. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    Sorry mate, the select statement was too long to fit on the page so I hurriedly added the _ to make it flow to the next line but I think I went wrong :) in your script if you make

    [code:1:8203afd588]
    Set OpSysSet=GetObject("winmgmts:{(Debug,RemoteShutdown)}//" &
    strsystem & "/root/cimv2").ExecQuery("Select * from
    Win32_OperatingSystem where Primary=true")
    [/code:1:8203afd588]

    all one line you shouldn't have a problem
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  14. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Works a treat Phil. Good work, thanks.

    SimonV
    :D
     
    Last edited: Jan 2, 2015
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  15. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    I got a problem with the shutdown script. If one of the PC's is already shutdown then the script halts and gives an error stating that the machine does not exist and that halts the script leaving the rest on.

    Can it be that if a PC is off then it will move onto the next PC?

    Si

    Also, for some reason the scripts wont run when executed by the teacher but they will if logged in by myself? Any ideas?
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  16. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    try adding

    [code:1:b662e940a7]
    on error resume next
    [/code:1:b662e940a7]

    to the top of the code which should make it carry on if one of the PC's is already off

    Does the Teacher have admin rights to the PC's ? if not thats probably why he cant shut them down
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  17. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    Will not have time to try this today but will let you know Monday. I thought it maybe a permission thing but thought I'd get your view on it anyway.

    Thanks Phil :thumbleft
     
    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  18. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    If the teacher doesn't have admin rights you could set the script to run as a scheduled task on one of your servers in the evening, that way they'll get shut down automatically if left on.
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade

Share This Page

Loading...