[SOLVED] putting a networked pc to sleep via cmd

Discussion in 'Windows 7' started by KryptiKal, Aug 8, 2011.

  1. KryptiKal

    KryptiKal MDL Novice

    Aug 22, 2009
    10
    1
    0
    I've been trying to find a "foolproof" batch-file based method of waking/putting a pc to sleep with some success. I've gotten the wake up bit working with Depicus' wolcmd tool and through the wol utility in my tomato router, both of which work great. Now I need to find a way to put it back to sleep... This is mainly so my house mates don't ever actually have to go into my room and turn the pc back on/off and so I can have it sleeping while I'm at college, it gets pretty warm in there if I leave it on all day but I still need to get at my projects occasionally. Also, I can make it go to sleep using windows live mesh to remote in, then choosing sleep from the start menu but I want to find a script based solution. Thanks for any help in advance..
     
  2. HDRyder9

    HDRyder9 MDL Novice

    Oct 22, 2009
    4
    0
    0
    #2 HDRyder9, Aug 9, 2011
    Last edited: Aug 9, 2011
    Assuming the name of your PC is Windows-PC simply: shutdown -m \\Windows-PC /s , a batch file will do.
     
  3. KryptiKal

    KryptiKal MDL Novice

    Aug 22, 2009
    10
    1
    0
    #4 KryptiKal, Aug 9, 2011
    Last edited: Aug 9, 2011
    (OP)

    The message I get back in the cmd is:

    nameOfComputer: Access is denied.(5)

    It may have something to do with the PC account having a password...
     
  4. KryptiKal

    KryptiKal MDL Novice

    Aug 22, 2009
    10
    1
    0
    @ Coasie in post #3

    Works like a charm and sooo easy. I made a shortcut and now putting it to sleep is just a double-click away! Thanks for letting me know about this little gem! It even works over the internet if you know your external ip.:worthy: