Tags

,

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?

Prerequistes:

  • 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:

  1. Unzip the file to %systemdrive%\inetpub\wwwroot.
  2. The file will unzip to a new folder, WakeOnLan.FileOps001
  3. 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.FileOps002

Edit the program files

We have to do a bit of housekeeping on the files included with the program to make everything work correctly.

  1. Open %systemdrive%\inetpub\wwwroot\WakeOnLan\Web.config in your favourite text editor.  I like notepad++, but standard notepad will work just fine also.
  2. Uncomment line 14 and add \WakeOnLan after connectionString=”Data Source=. (note we are adding this text after the period).
  3. 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).
  4. Your file should now look like this screenshot:WebConfigEdit
  5. Open %systemdrive%\inetpub\wwwroot\WakeOnLan\App_Data\Schema.sql in your text editor.
  6. Change line 8 so it says use WakeOnLan instead of just use.  It should look like this screenshot now:SchemaEdit

 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.

  1. Open SQL Server Installation Centre.
  2. Choose Options (1) and make sure your Installation Media Root Directory (2) is correct otherwise you will not be able to continue.SQLServerInstallationCentre001
  3. Now choose Installation (1) and select the first option, New installation or add features to an existing installation (2).SQLServerInstallationCentre002
  4. 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.SQLServerInstallationCentre003
  5. 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.SQLServerInstallationCentre004
  6. 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.SQLServerInstallationCentre005
  7. 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.SQLServerInstallationCentre006
  8. 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.SQLServerInstallationCentre007
  9. 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.
  10. SQLServerInstallationCentre007aYou 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:

  1. 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.MSSMS001
  2. 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
  3. 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.MSSMS002
  4. 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.MSSMS003
  5. 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.MSSMS004
  6. You will now see BUILTIN\IIS_IUSRS appear as a valid Login for this instance.MSSMS005
  7. 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.MSSMS006
  8. 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.MSSMS007
  9. The user appears in the list box.  Click OK.MSSMS008
  10. Under Database role membership, scroll down to the bottom of the list and check WakeOnLanServer.  Your dialog box should look like this screenshot:MSSMS009
  11. After clicking OK, you’ll see the new user has been created.MSSMS010
  12. We are done working with the database instance now.  You can close SQL Management Studio.

Configure IIS

Now we have to configure IIS to serve the webpage.

  1. Open IIS Manager.
  2. 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.
  3. Right-click on WakeOnLan and select Convert to Application.IIS001
  4. 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.IIS002
  5. Your Add Application dialog should now look like this:IIS003
  6. 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:IE001

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:

  1. Click Add New Computer.AddComputer001
  2. Fill in the computer name and click Add Computer.AddComputer002
  3. 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.

Conclusion

There it is, a simple and free web-dashboard to wake-up your computers! I Hope this proves useful for you in your organization.

Advertisements