Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Technician Andyyy41's Avatar
    Join Date
    Nov 2012
    Location
    Luton
    Posts
    14
    Rep Power
    24

    7855 - Schedule Reboot - PowerShell

    Hi all. Not sure if this is the right place to ask. I have a fleet of 70+ 7855's and I want to schedule a reboot over the weekend automatically. I found a code for PowerShell to do this, but it doesn't seem to work.
    Code:
    $CookieContainer = New-Object System.Net.CookieContainer
    
    function SendGET([string]$url)
    {
    [net.httpWebRequest] $req = [net.webRequest]::create($url);
    $req.Method = "GET";
    $req.Accept = "text/html";
    $req.CookieContainer = $CookieContainer;
    [net.httpWebResponse] $res = $req.getResponse();
    $resst = $res.getResponseStream();
    $sr = new-object IO.StreamReader($resst);
    $result = $sr.ReadToEnd();
    return $result;
    }
    
    
    
    
    function SendPOST([string]$url, [string]$data)
    {
    $buffer = [text.encoding]::ascii.getbytes($data)
    [net.httpWebRequest] $req = [net.webRequest]::create($url)
    $req.method = "POST"
    $req.ContentType = "application/x-www-form-urlencoded"
    $req.ContentLength = $buffer.length
    $req.KeepAlive = $true
    $req.CookieContainer = $CookieContainer
    $reqst = $req.getRequestStream()
    $reqst.write($buffer, 0, $buffer.length)
    $reqst.flush()
    $reqst.close()
    [net.httpWebResponse] $res = $req.getResponse()
    $resst = $res.getResponseStream()
    $sr = new-object IO.StreamReader($resst)
    $result = $sr.ReadToEnd()
    $res.close()
    return $result;
    }
    
    
    
    
    # Request to get session id
    $x = SendGET ("http://10.64.135.52/properties/authentication/login.php");
    # Post login to get new session id
    $x = SendPOST ("http://10.64.135.52/userpost/xerox.set") ("_fun_function=HTTP_Authenticate_fn&NextPage=%2Fproperties%2Fauthentication%2FluidLogin.php&webUsername=admin&webPassword=1111&frmaltDomain=default");
    
    
    # Post reboot command with loggedin session id
    $x = SendPOST ("http://10.64.135.52/userpost/xerox.set") ("_fun_function=HTTP_Machine_Reset_fn&NextPage=/status/rebooted.php");
    Firstly, anyone PowerShell savvy know why? PS just says completed, but the machine is still on. Secondly, is there another way? I can'y seem to find one, but i haven't asked here yet.

    Any help much appreciated.

    Andy

  2. #2
    Field Supervisor 500+ Posts Exok's Avatar
    Join Date
    Jun 2011
    Location
    Edison, NJ
    Posts
    750
    Rep Power
    40

    Re: 7855 - Schedule Reboot - PowerShell

    Program the machines to do a weekly on demand image overwrite on the weekend. Once its complete, the machines will reboot. You can set that in admin tools.

  3. #3
    davidL
    Guest

    Re: 7855 - Schedule Reboot - PowerShell

    hi
    sorry if this is pointing out the obvious - are your devices still configured with default passwords??

  4. #4
    Technician Andyyy41's Avatar
    Join Date
    Nov 2012
    Location
    Luton
    Posts
    14
    Rep Power
    24

    Re: 7855 - Schedule Reboot - PowerShell

    Yeah they are. Hence why i put them in the script. The HDD wipe seems to be doing the trick at the moment, so thank you.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Get the Android App
click or scan for the Copytechnet Mobile App

-= -= -= -= -=


IDrive Remote Backup

Lunarpages Internet Solutions

Advertise on Copytechnet

Your Link Here