Creating a Data Class to Hold the Data
First up, we need to create a Custom Inventory class to hold the information from the user interface. Under the Settings Menu, select "All Settings". Then go under "Discovery and Inventory" and "Inventory Solution" and select "Manage Custom Data Classes":
Select the New Data Class button and call the data class "User Maintenance Windows". You will then need to add two attributes to the data class: An "Index" of type "Int" and a "Window" of type String 50:
Finally, beside the "New data class" button, click on the details button. The important thing hers is to grab to data class GUID:
Creating the User Interface
You can do this in a number of ways. Myself, I created my UI in Visual Studio 2005 and wrote the code in C#. The code itself will run on any computer running .NET 2.0+, and we have fairly universal coverage of that, plus as we're distributing it with the Software Management Framework, we can create a .NET distribution package and create a dependency upon it anyway.
So, I created a pretty simple Windows Form to select maintenance windows from a Check Box List control, along with a "Submit" button. You can dress this up a lot over my example! The extra window over to the right is a debug output window you'll see in a bit when we get into the code.
The only code I have here is for the "button1_Click" event. And it's pretty straightforward:
private void button1_Click(object sender, EventArgs e)
{
Guid maintdc = new Guid("bf11710c-c90b-4f11-a42a-5f983a6c77d1"); //This guid came from when we created the DC
AeXNSEvent.AeXNSEvent nse = new AeXNSEvent.AeXNSEvent();
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"; // From the Custom Inventory manual, don't change this one
nse.Priority = 1; //Again, don't mess with this.
AeXNSEventDataClass dc = nse.AddDataClass("User Maintenance Windows");
dc.FirstColumn = 0;
AeXNSEventDataBlock db = nse.AddDataBlock(dc,nse.DefaultResource);
db.PartialUpdate = 0;
foreach (int current in checkedListBox1.CheckedIndices)
{
AeXNSEventDataRow dr = db.AddRow(0);
dr.AddField("Index");
dr.AddField("Window");
dr.SetField(0,current);
dr.SetField(1, checkedListBox1.Items[current].ToString());
}
nse.Send("AltirisNS8"); //This is your NS
textBox1.Text = nse.Xml; //Debug code to dump all the XML out to a text box on screen to look at...won't be in final version
}
Create Filters for Your Windows
OK, so now you have a way for your users to get information about when you can hammer their computers back to you. This provides you with a flexible way to run intensive scans, while providing the users with the opportunity to have some control of their environment! What's best, the users require zero rights to the console to effect these changes!
Now you need to create filters for each of your maintenance windows. These are simple Raw SQL filters based on the data class you just created. For example, to use the Mid-0300 filter, simply use this SQL:
select
_resourceguid as guid
from
Inv_User_Maintainance_Windows
where
window = 'Mid-0300'
You need to repeat this process for each window you created in your UI. One nice thing about how the maintenance windows work is that you don't have to do all the permutations and combinations of maintenance windows, you can stick to making one for each, as if you are part of 2 or more maintenance windows, you can simply add the user to more than one.
Create Your Maintainance Windows
Finally, for each of your windows, create a maintenance window and assign that maintenance window to your filter you just created. Finally, create a "default" maintenance window, and exclude each of the "User" filters from it, so that even when a user hasn't selected anything you still have something for a window!