Go Back > Great Internet Mersenne Prime Search > Software

Thread Tools
Old 2013-06-25, 14:40   #1
sixblueboxes's Avatar
Feb 2013
Charlotte, North Carolina

31 Posts
Default Running on a schedule as a windows service in active directory

I have 30 computers in my GIMPS arsenal, using computers at my place of business. I thought I'd share my experience and code in the hopes that it may help others considering this same setup, and also to seek input from other administrators who may have suggestions for improvement.

We have a Windows Active Directory environment here and I have 25 of our workstations on GIMPS. Because I don't want to deal with users complaining about slow machines, I only want to run Prime95 after hours. To do this, I'm using the Windows Service versions found here and here . This way, I can start and stop GIMPS remotely as a windows service, with absolutely no interruption to any users. The only requirement is that the comptuer is on. I just need to start it after everyone leaves and stop it before everyone comes to work.

Windows has no way to have a service start and stop on a schedule, so at first I started and stopped it using a scheduled task on each workstation that ran a batch file. The batch file had one line: "NET STOP "Prime Service"". I also created an MMC snap in to be able to turn them on and off manually, and another to monitor all of the scheduled tasks. Each scheduled task was deployed with group policy. These methods worked fine for a while; however I still had some pitfalls -- there was no way to quickly find out what stations were running Prime95, and the snap-ins were very slow.

When the scheduled tasks stopped working because the account running them had a password change, I figured it was a good time to look into something someone had suggested: Turning the services on and off from one location all at once using Windows Powershell. After some initial testing I came up with several scripts I am now using to manage Prime95 on each computer.

This one turns on and off Prime95 on batches of computers that it finds in an input file:

param([String]$newStatus="Stopped", [String]$computersFilename="")
if ($computersFilename -eq "") {
    echo "no filename entered"
$computers = Get-Content $computersFilename
foreach ($i in $computers) {
    Set-Service -Computername $i -Name NTPrimeService -Status $newStatus

This one will poll each computer in the list to find out if Prime95 is running:

$computers = Get-Content computers.txt
$numberRunning = 0
Write-Host "$process is running on:"
foreach ($i in $computers) {
    if (Get-WmiObject -Class Win32_Process -ComputerName $i -Filter "name like '$process%'") {

This one takes input from the user to start or stop an individual computer:
while (1 -eq 1) {
    $action = Read-Host "Do you want to start or stop? (or 'quit')"
    if ($action -eq 'quit') {
    } elseif ($action -eq 'start') {
        $newStatus = 'Running'
    } elseif ($action -eq 'stop') { 
        $newStatus = 'Stopped'
    } else {
        $newStatus = 'Invalid'
    if ($newStatus -ne 'Invalid') {
        $computer  = Read-Host "Enter computer name"
        Write-Host "Setting $computer to status $newStatus"
        Set-Service -Computername $computer -Name NTPrimeService -Status $newStatus

The first script runs as a scheduled task on the "server" computer, and the other two I use to manage machines manually. (If someone is gone for the day, I can run Prime95 all day on their computer.) The last script is better/faster than using a snap-in, because I don't have to wait for the snap-in into build the list of services on the computer before I can start or stop the one I want to.

When installing Prime95 on each computer, I uncheck "Start at startup", and change the startup type for the service to "manual".

I've considered several other modifications, like having Prime95 use configuration files loaded from the server instead of from their local hard drives. That way if I wanted to change the memory settings on all of them I could do it in one file rather than changing the configuration on one computer at a time. So far I've had no need to change any of the settings, so this hasn't really been a problem.

I'm using only computers that are mainly used by one person, who isn't a salaried employee. I don't have it on any laptops (except my own). It seems that most of our workstations don't make any additional noise when running Prime95.
sixblueboxes is offline   Reply With Quote

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Server 2012 R2 Prime Service automatisation Tutti Information & Answers 1 2016-11-25 23:42
Running a Windows machine at the end of a wire fivemack Programming 2 2015-06-30 18:02
Prime 95 crashing on laptop running as service remaker Software 2 2007-03-19 02:26
Help configuring prime95.ini run schedule Raterus Software 5 2007-01-18 21:36
Windows XP and Service Pack 2 M0CZY Software 17 2006-04-05 16:24

All times are UTC. The time now is 16:45.

Sat May 8 16:45:57 UTC 2021 up 30 days, 11:26, 1 user, load averages: 2.92, 2.74, 2.89

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.