+ Post New Thread
Page 7 of 9 FirstFirst ... 3456789 LastLast
Results 91 to 105 of 123
Windows Thread, Software to shut down PC's? in Technical; If you have WMI available on the machines you can control them with that scripted. I have just started working ...
  1. #91

    Join Date
    Jan 2013
    Posts
    96
    Thank Post
    23
    Thanked 11 Times in 10 Posts
    Rep Power
    5
    If you have WMI available on the machines you can control them with that scripted. I have just started working on custom solution for our school, for wake, reboot and shutdown machine groups.

    I create text files for machine groups e.g labs containing lists of machine names and mac addresses (machine name used for reboot and shutdown, mac used for wake). I'm also using powershell and the scripts are still work in progress but might be handy for some one else looking for same thing, I'm hoping to expand the functions and build and management web framework around them.

    Shutdown.ps1
    #### Provide the computer name in $computername variable

    $ServerName = Get-Content $args[0]

    ##### Script Starts Here ######

    foreach ($Server in $ServerName) {

    $machine = $Server.split(",")[0]

    Write-Host Shutting Down $machine

    Get-WmiObject win32_operatingsystem -ComputerName $machine | Invoke-WMIMethod -name Win32Shutdown
    }

    ########## end of script #######################


    Restart.ps1
    #### Provide the computer name in $computername variable

    Param ([switch]$force)


    $shutdownValue = 2

    if ($force -eq $true) $shutdownValue = 6


    $ServerName = Get-Content $args[0]

    ##### Script Starts Here ######

    foreach ($Server in $ServerName) {

    $machine = $Server.split(",")[0]

    Write-Host Shutting Down $machine


    # 0 (0x0) Log Off
    # 4 (0x4) Forced Log Off (0 + 4)
    # 1 (0x1) Shutdown
    # 5 (0x5) Forced Shutdown (1 + 4)
    # 2 (0x2) Reboot
    # 6 (0x6) Forced Reboot (2 + 4)
    # 8 (0x8) Power Off
    # 12 (0xC) Forced Power Off (8 + 4)

    Get-WmiObject win32_operatingsystem -ComputerName $machine | Invoke-WMIMethod -name Win32Shutdown -ArgumentList @($shutdownValue)
    }

    ########## end of script #######################

    wake.ps1
    Function WakeMAC([String]$macString = $(write-host 'MAC address is required')){
    If ($macString -ne ""){
    $mac = $macString.split(':') | %{ [byte]('0x' + $_) }
    }

    if ($mac.Length -ne 6)
    {
    write-host 'Invalid MAC address'
    }
    Else{
    $UDPclient = new-Object System.Net.Sockets.UdpClient
    #$UDPclient.Connect(([System.Net.IPAddress]::Broadcast),4000)
    #write-host ([System.Net.IPAddress]::Broadcast)
    $UDPclient.Connect($ip,$port)
    $packet = [byte[]](,0xFF * 102)
    6..101 |% { $packet[$_] = $mac[($_%6)]}


    [Void] $UDPclient.Send($packet, $packet.Length)
    [Void] $UDPclient.Send($packet, $packet.Length)
    [Void] $UDPclient.Send($packet, $packet.Length)

    write-host "Wake-On-Lan magic packet of length $($packet.Length) sent to $macString"
    }
    }


    [string]$ip="10.105.103.255"
    [int]$port=7

    $machines = Get-Content $args[0]

    # wake all the machines in the group
    foreach ($machine in $machines) {

    write-host machine $machine ip $ip port $port
    $mname = $machine.split(",")[0]
    $mmac = $machine.split(",")[1]

    write-host Waking $mname mac $mmac

    wakeMAC($mmac)
    Start-Sleep -seconds 1 # Prevent boot storm

    }


    ping.ps1
    #### Provide the computer name in $computername variable

    $ServerName = Get-Content $args[0]

    ##### Script Starts Here ######

    foreach ($Server in $ServerName) {

    $machine = $Server.split(",")[0]

    if (test-Connection -ComputerName $machine -Count 1 -Quiet ) {
    Write-Host $machine "alive"
    } else {
    Write-Warning "$machine No Reply"
    }
    }

    ########## end of script #######################

  2. #92

    Join Date
    Mar 2007
    Location
    Norfolk.
    Posts
    166
    Thank Post
    28
    Thanked 8 Times in 8 Posts
    Rep Power
    16
    Still struggling to find a program that will let the end user cancel shutdown!

    Any ideas? I may have to write a program..but I'm not good at code! lol

  3. #93

    Join Date
    Mar 2007
    Posts
    1,754
    Thank Post
    79
    Thanked 288 Times in 219 Posts
    Rep Power
    85
    Quote Originally Posted by ChrisN-0123 View Post
    Still struggling to find a program that will let the end user cancel shutdown!

    Any ideas? I may have to write a program..but I'm not good at code! lol
    This. Coretech Blog Blog Archive Configuration Manager shutdown utility

  4. #94

    Join Date
    Mar 2007
    Location
    Norfolk.
    Posts
    166
    Thank Post
    28
    Thanked 8 Times in 8 Posts
    Rep Power
    16
    That's absolutely perfect, thanks loads strawberry!

  5. #95

    fiza's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    2,095
    Thank Post
    407
    Thanked 310 Times in 262 Posts
    Rep Power
    152
    Is this a standalone program or do you need "configuration Manager" to use it?

  6. #96

    Join Date
    Mar 2007
    Posts
    1,754
    Thank Post
    79
    Thanked 288 Times in 219 Posts
    Rep Power
    85
    can be standalone, is perfect for sccm.

    You can use GPP to deploy the files, then use either a scheduled task or a remote command line to call it.

  7. Thanks to strawberry from:

    fiza (21st May 2013)

  8. #97

    Join Date
    Apr 2010
    Posts
    2,036
    Thank Post
    83
    Thanked 187 Times in 154 Posts
    Rep Power
    83
    I am trying do download Configuration Manager shutdown utility but the site says I need to log in. Anyone got the software? or tell me how I log in.

  9. #98

    fiza's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    2,095
    Thank Post
    407
    Thanked 310 Times in 262 Posts
    Rep Power
    152
    Quote Originally Posted by edutech4schools View Post
    I am trying do download Configuration Manager shutdown utility but the site says I need to log in. Anyone got the software? or tell me how I log in.
    Same here

  10. #99

    Join Date
    Apr 2010
    Posts
    2,036
    Thank Post
    83
    Thanked 187 Times in 154 Posts
    Rep Power
    83

  11. Thanks to edutech4schools from:

    fiza (21st May 2013)

  12. #100

    Join Date
    Mar 2007
    Location
    Norfolk.
    Posts
    166
    Thank Post
    28
    Thanked 8 Times in 8 Posts
    Rep Power
    16
    yeah I couldnt logon..but clicked blogs and there was shutdown software link in there somewhere..downloaded and runs perfectly.

    Got a scheduled task set within group policy to run it. PERFECT!

    Thanks save a fortune with these staff who are too lazy to shutdown each night.

  13. #101

    fiza's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    2,095
    Thank Post
    407
    Thanked 310 Times in 262 Posts
    Rep Power
    152
    Quote Originally Posted by ChrisN-0123 View Post
    yeah I couldnt logon..but clicked blogs and there was shutdown software link in there somewhere..downloaded and runs perfectly.

    Got a scheduled task set within group policy to run it. PERFECT!

    Thanks save a fortune with these staff who are too lazy to shutdown each night.
    Does it work when a user has locked the machine beforehand? Our users tend to lock the machine and then go home.

  14. #102
    cuester's Avatar
    Join Date
    Jul 2011
    Location
    Nova Scotia, Canada
    Posts
    14
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    7
    The best free standalone shut down program I've seen ( and use in all my seven schools) is poweroff. It's an exe that let's you create a service that shuts down the machine at a certain time. You can also configure it to pop up with a notice that states that the machine is shutting down and to cancel this action press cancel.

  15. #103

    fiza's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    2,095
    Thank Post
    407
    Thanked 310 Times in 262 Posts
    Rep Power
    152
    Quote Originally Posted by cuester View Post
    The best free standalone shut down program I've seen ( and use in all my seven schools) is poweroff. It's an exe that let's you create a service that shuts down the machine at a certain time. You can also configure it to pop up with a notice that states that the machine is shutting down and to cancel this action press cancel.
    How does it cope with locked machines?

  16. #104

    Join Date
    Apr 2010
    Posts
    2,036
    Thank Post
    83
    Thanked 187 Times in 154 Posts
    Rep Power
    83
    Just got shutdownTool up and running

    How does it cope with locked machines?
    I noticed in the task scheduler you have the option to run even if nobody is logged in.

    I need to work how to only get the software to run when in school and not if a teacher takes a laptop home. Any ideas?

  17. #105

    fiza's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    2,095
    Thank Post
    407
    Thanked 310 Times in 262 Posts
    Rep Power
    152
    Quote Originally Posted by edutech4schools View Post
    Just got shutdownTool up and running



    I noticed in the task scheduler you have the option to run even if nobody is logged in.


    I need to work how to only get the software to run when in school and not if a teacher takes a laptop home. Any ideas?
    But if the machine is locked then someone is logged on.

SHARE:
+ Post New Thread
Page 7 of 9 FirstFirst ... 3456789 LastLast

Similar Threads

  1. UPS Won't Shut Up.
    By Greg_Jones in forum Hardware
    Replies: 12
    Last Post: 27th November 2007, 09:21 AM
  2. Replies: 6
    Last Post: 19th October 2007, 02:48 PM
  3. Shut Down Options
    By tomlin in forum How do you do....it?
    Replies: 9
    Last Post: 7th October 2007, 12:59 AM
  4. Script to shut down computers in a certain OU
    By tosca925 in forum Scripts
    Replies: 11
    Last Post: 25th September 2005, 09:23 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •