Jump to content

Recommended Posts

Posted
Here it is. Only works for XP. Hope it works.

 

As we are getting a new computers with XP Pro across the entire school soon, my original issues are now resolved. I'm gonna download a copy of this and keep it for when the new computers are installed.

 

Thanks for this :D

  • 11 months later...
Posted
In a startup script (on our image that is cloned / or in a group policy startup script)

 

REM Delete all tasks (not needed, butin case some evil person already has)
schtasks /delete /tn * /f 

REM Create a task for this computer to shut itself down at 6pm
schtasks /create /sc daily /st 18:00:00 /tn "Shutdown at 1800" /tr "shutdown -s -t 60 -c \"This computer is scheduled to automatically shutdown at this time.          You have 60 seconds to save all your work and logoff.\"" /ru system

 

This way theres no "I need a list of pc's" or "use this tool just search google all day" these are all in windows already and just need to be run once per machine - or placed carefully in a startup script. (Note, this is used on WinXP clients, with 2000 YMMV)

 

fooby

 

Sorry for digging up such an thread. But the holiday is here and work must go on!

 

This script works when i run it on my computer, but when i save it as a .bat and set it to a logon script it doesn't run.

 

Could anyone shed any light?

 

Mike

Posted

This script works when i run it on my computer, but when i save it as a .bat and set it to a logon script it doesn't run.

The logon script doesn't have admin rights to the local machine? You can't have non-admins able to create scheduled tasks that run with system rights - that'd be a huge security hole!

Try creating an MSI that will execute your batch file. You can do this easily through Windows Installer Wrapper Wizard You can then pop this into active directory and it will run with elevated rights.

Posted

I use the following tool which I schedule to run every evening.

 

Save it in a folder called Remoteshutdown on any server. Now open up notepad and copy the following:

 

REM \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
REM
REM	  ICT Shutdown Script
REM          Shutdown Time: [i]time[/i]
REM       Scheduled on [i]servername[/i]
REM       
REM	     
REM \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
       
remoteshutdown.exe /remote:[i]Computername[/i] /f
remoteshutdown.exe /remote:[i]Computername[/i] /f
remoteshutdown.exe /remote:[i]Computername[/i] /f
remoteshutdown.exe /remote:[i]Computername[/i] /f
remoteshutdown.exe /remote:[i]Computername[/i] /f
remoteshutdown.exe /remote:[i]Computername[/i] /f

 

Replace Computername with your actual workstation names. Now save the file as Remoteshutdown.bat in the Remoteshutdown folder. Now run Scheduled Tasks and when prompted, choose the batch file you've just created to run at a select time, daily, with domain admin credentials.

 

That's it, job done. Your workstations will shutdown at the scheduled time. I use this at many schools running on 2003 Server and XP clients. I haven't tested it on Vista yet.

Posted

I've decided to use the "system shutdown v1.1.msi" and this works perfectly, it installs ok on the computer startup as supposed to, but after installation it shutsdown the computer! can anyone modify the msi to stop it doing this.=?

 

Thanks

 

Mike

Posted
I've decided to use the "system shutdown v1.1.msi" and this works perfectly, it installs ok on the computer startup as supposed to, but after installation it shutsdown the computer! can anyone modify the msi to stop it doing this.=?

 

Shutsdown the computer? It doesn't do this on our system. (I made it, by the way) it might restart the computer (I don't think it does) but I don't even know how to make shutdown!

Is there any chance it was a fluke, eg. caused by WSUS applying some updates?

Posted

Thanks for the program! works a treat, cant understand why it shuts down tho, but the week is running out so i shall just email the staff giving them warning of the shutdown on first switching back on.

 

Many Thanks

 

Mike

  • 5 years later...
Posted

Hi all!!

 

Does anyone know of a shutdown program thst you can schedule to force a shutdown..but with a pop up letting a user cancel? Would prefer to have cancel option up a good 15 minutes.

 

Im using the shutdown command at the moment..but have to fun this later at night as more and more staff are staying later now and especially need a cancel button for parents evening/training etc.

 

Dont care if its free or pay for as i've been looking for a long time now and just want it sorted.

 

Cheers!

Posted

We use a programme called netsupport;

 

Welcome to the home of NetSupport

 

it give the teachers the option of classroom control but also has a technician console, this means that if people do leave pc’s on I can not only connect to them but turn them off, restart or with the aid of pxe boot turn the pc’s on for them, it’s a fantastic programme.

Posted

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 #######################

  • 3 weeks later...
Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...