Having a web-based dashboard that lets you wake up your network computers is extremely helpful both for IT managers and for end users. Your users can now wake up their computers so they can work by remote (via RDP) and IT techs can wake systems up for maintenance. But, how can we make a web-based dashboard to do this easily and for free?
- SQL 2008/2008r2 either Express or Full must be installed on your server or you have access to an installation
- Your computers have to be setup properly for WOL to function (BIOS and Windows)
Get the software:
Thankfully, the software has already been made, so we don’t have to do any programming. Head over to http://wol.codeplex.com/ and download the zipped binaries. We don’t need the full installer because it skips steps… if it didn’t, we wouldn’t need this article!
Setup the software:
Now that you have the zipped source file, let’s get things unzipped and setup:
- Unzip the file to %systemdrive%\inetpub\wwwroot.
- The file will unzip to a new folder, WakeOnLan.
- Double-check that permissions inherited properly. You should see IIS_IUSRS listed with Read & Execute, List and Read permissions. If these haven’t propagated, make sure you allow inherited permissions on this folder and it’s contents.
Edit the program files
We have to do a bit of housekeeping on the files included with the program to make everything work correctly.
- Open %systemdrive%\inetpub\wwwroot\WakeOnLan\Web.config in your favourite text editor. I like notepad++, but standard notepad will work just fine also.
- Uncomment line 14 and add \WakeOnLan after connectionString=”Data Source=. (note we are adding this text after the period).
- Comment line 17 since we are not using SQLExpress (even if you are using the Express version of SQL Server, we have to use the connection string on line 14).
- Your file should now look like this screenshot:
- Open %systemdrive%\inetpub\wwwroot\WakeOnLan\App_Data\Schema.sql in your text editor.
- Change line 8 so it says use WakeOnLan instead of just use. It should look like this screenshot now:
Setup a new SQL instance
We need to make a new SQL instance and database for our WOL program. We will use the SQL installation wizard to do this, so you’ll need your SQL installation media available. If you need a copy of the installation files, you can download them from Microsoft, just search for your particular version of SQL. In this example, I’m using SQL Server 2008 r2 Express on Windows SBS 2011.
- Open SQL Server Installation Centre.
- Choose Options (1) and make sure your Installation Media Root Directory (2) is correct otherwise you will not be able to continue.
- Now choose Installation (1) and select the first option, New installation or add features to an existing installation (2).
- After the wizard completes a rule-check and verifies the installation media, you’ll be presented with the Installation Type screen. Select New Installation or add shared features. Click next.
- On the Feature Selection screen, deselect everything except Database Engine Services under Instance Features and click Next. This is because we only want to install a database instance, we don’t want to do anything else.
- Now we have to configure the instance. Choose Named Instance and give it a name, I chose WakeOnLan (1). I also named the Instance ID WakeOnLan (2). Your Instance Root Directory (3) will default to wherever SQL is installed, I chose a different directory that I use to host all my SQL databases so they are off the OS disk. This is optional and you can choose any path you’d like. Click next.
- On the Server Configuration page, choose NT Authority\System and leave the password blank. This is the account that will run the newly created database instance. Click next.
- Now we will proceed with configuring the database engine. On the Account Provisioning Tab, select Windows Authentication mode and make sure you and/or any relevant administrators are listed as SQL Server Administrators for this database instance.
- Select the Data Directories tab just to make sure everything is being installed to the correct directories as you specified in step 6. Assuming all is ok, click Next.
- You may choose whether or not to submit usage data to Microsoft at this point. Click Next, allow the wizard to finish and your new database named instance has been created.
Create the WakeOnLan database
Now that we have a separate named instance, we need to create the actual database the program will use. Fortunately, this is all scripted and done for us. Let’s do this step-by-step:
- Open SQL Server Management Studio and open the named instance .\WAKEONLAN we created in the previous steps. You’ll notice that it only has the default System Databases installed. Close SQL Server Management Studio.
- Open a command prompt as an administrator and run the following command (this IS case-sensitive!): sqlcmd -S .\WAKEONLAN -E -i %systemdrive%\inetpub\wwwroot\WakeOnLan\App_Data\Schema.sql
- If the previous command completes successfully, you will receive the message “Changed database context to ‘WakeOnLan’.” This means our new database has been created in our named instance. We can verify this in SQL Server Management Studio.
- Now we need to add a new user for the IIS web-user so it can access the database. If we don’t do this, we would have to allow the script to impersonate an administrator and that is an unacceptable security risk. Expand Security > Logins and right-click to add a New Login.
- Click the Search button so we can browse AD for the user to add. Type IIS_IUSRS, click Check Names (to verify no typos) and then click OK.
- You will now see BUILTIN\IIS_IUSRS appear as a valid Login for this instance.
- Now we authorize this user on our actual database so they can interact with it. Expand Databases > WakeOnLan > Security > Users and right-click to create a New User.
- Name your new user (I chose IIS_IUSRS for consistency). In the next field, click the “…” button, click Browse and select BUILTIN\IIS_IUSRS and click OK.
- The user appears in the list box. Click OK.
- Under Database role membership, scroll down to the bottom of the list and check WakeOnLanServer. Your dialog box should look like this screenshot:
- After clicking OK, you’ll see the new user has been created.
- We are done working with the database instance now. You can close SQL Management Studio.
Now we have to configure IIS to serve the webpage.
- Open IIS Manager.
- Expand the Default Web Site and you’ll see the directory you created after unzipping the source binaries. In this example, we named it WakeOnLan. If you don’t like that name, rename the directory. Whatever you type here will be what your user has to type after your servername/remote url. In this case, it is localhost/wakeonlan.
- Right-click on WakeOnLan and select Convert to Application.
- Change the Application Pool by clicking the Select button and then choosing DefaultAppPool. Click OK. This is important since this Application Pool supports .Net Framework 2.0. You can use any other Application Pool so long as it supports .Net Framework 2.0 and only that version. Application Pools for .Net Framework 4.0, for example, will cause problems. If you want to create a dedicated Application Pool for this program, you can do that too, but that’s outside the scope of this tutorial.
- Your Add Application dialog should now look like this:
- Click OK. The directory has been converted to an application and we’re done configuring IIS.
Testing in a browser
You can now open your new web application in any web browser. Simply go to http://localhost/wakeonlan and you’ll see a webpage like this:
Of course, if you changed the folder name to something other than WakeOnLan then you’d browse to that name instead. If your default website is accessible remotely, then you can also go to http://YourRemoteUrl/wakeonlan.
Adding computers to wake up
Using the dashboard is pretty self-explanatory. The first step will be to add some computers to the list. Before continuing, make sure the computers you’d like to add are powered on! This is critical because the program will need to resolve the target computer’s MAC address. Let’s add a computer now:
- Click Add New Computer.
- Fill in the computer name and click Add Computer.
- That’s it, your computer shows up in the list. Repeat this process for all of your systems.
When your computers are asleep, you will see a link to wake them up under the ‘Wake’ column. Computers that are awake will have a blue icon, sleeping/powered-off computers will have a black icon and computers that are in the process of waking up will have a yellow icon.
There it is, a simple and free web-dashboard to wake-up your computers! I Hope this proves useful for you in your organization.