Good afternoon,
I have managed to investigate, acquire, and adapt a script to wake-up my Desktop computer from my Laptop computer.
My Desktop computer has a shared internal HDD and a shared USB connected HDD which are both available from my Laptop when I wake-up my Desktop from the script run from my Laptop.
This all works as needed. So far so good.
My question is, how can I put the Desktop computer to sleep from my Laptop.
I have a .bat file on the Desktop computers Desktop with the following code . . .
Code: Select all
@echo off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
I have investigated and tried MANY MANY MANY code snippets to try and run the .bat file [Desk_Sleep.bat] on the Desktop from my Laptop but unfortunately to no avail.
This was just one I tried which did seem promising . . .
Code: Select all
Function Run-BatchFile
{
param($computer = "<Computer_Name_Here>")
$BatFileName = "Desk_Sleep.bat"
Invoke-Command -ComputerName $computer -ScriptBlock {param($BatFileName) & "cmd.exe /c C:\Users\<User_Name_Here>\Desktop\$BatFileName" } -ArgumentList $BatFileName -AsJob
}
Run-BatchFile
PAUSE
Thanks in advance.