Patch Management Solution Automation Tools for Patch Management Solution 6.2
Document sections:
- Command line arguments
- Command line usage examples
- SQL Query within the cs file
- SQL query change example
- Solution file list
Command line arguments
/task:EnableAll
/task:DisableAll
/task:CreateAllTasks
Note: The following command line examples assume that the Notification Server install directory is under the system folder %programfiles%. If you have installed the Notification Server on a different drive change the path accordingly.
Command line usage examples
So to enable all bulletins in a Patch Management Solution copy the nscript.nrf and pms62auto.cs onto '%programfiles%\Altiris\Notification Server\bin' and run the following command line:
"%programfiles%\Altiris\Notification Server\bin\nscript.exe" pms62auto.cs /task:EnableAll
To disable all bulletins use the following command line:
"%programfiles%\Altiris\Notification Server\bin\nscript.exe" pms62auto.cs /task:DisableAll
To create a Software Update task for all bulletin (that do not have an update task created and that are enabled and that have downloaded all update files) run the following command line:
"%programfiles%\Altiris\Notification Server\bin\nscript.exe" pms62auto.cs /task:CreateAllTasks
SQL Query within the cs file
Additionally you can control the bulletins to be enable or disabled by changing the SQL statement to suit your needs. Below in red is a sample modification to the pms62auto.cs, with the SQL statement in blue and modified elements in red :
public static GuidCollection GetSoftwareBulletins()
{
GuidCollection gcResources = new GuidCollection();
string strSelect = @"
SELECT ItemResource.Guid, vItem.Name FROM ItemResource
join Inv_Software_Bulletin on ItemResource.Guid = Inv_Software_Bulletin._ResourceGuid
join ItemActive on ItemResource.Guid = ItemActive.Guid
join vItem on ItemResource.Guid = vItem.Guid
WHERE ItemResource.ResourceTypeGuid = @resourceTypeGuid
and Deleted = 0 and Enabled = 1
and vItem.Name in ('MS07-033','MS07-024','MS07-012','MS06-50','KB-923097','KB-913807')
ORDER BY FirstReleaseDate DESC, vItem.Name DESC
SQL query change example
If you want to test the SQL query on the server before executing you can use the following SQL statement and modify the where close to suit your needs:
SELECT ItemResource.Guid, vItem.Name
FROM ItemResource
join Inv_Software_Bulletin on ItemResource.Guid = Inv_Software_Bulletin._ResourceGuid
join ItemActive on ItemResource.Guid = ItemActive.Guid
join vItem on ItemResource.Guid = vItem.Guid
WHERE ItemResource.ResourceTypeGuid = '3063DB82-7011-4A03-86CA-7BE49FB749CC'
and Deleted = 0 and Enabled = 1
and vItem.Name in ('MS07-033','MS07-024','MS07-012','MS06-50','KB-923097','KB-913807')
ORDER BY FirstReleaseDate DESC, vItem.Name DESC
File list
- nscript.nrf
- pms62auto.cs
- pms62auto_howto.html
The nscript.nrf file list the assemblies that should be loaded by nscripts (PMS 6.2 assemblies), while the pms62auto.cs was written to provide a one-stop shop for most automation tasks. So it takes certain command line arguments (which are case sensitive) as described below.
Comments
Clarification needed
If you ran task:CreateAllTasks it would create a single task of all enabled and downloaded bulletins in your Patch Management soluiton? Alternatively if you selected individual bulletins in the SQL script it would create a single task just for those bulletins defined in the SQL script (assuming they are already enabled/downloaded)?
thanks
Hi G Ross, If you run
Hi G Ross,
If you run task:CreateAllTasks it would created one task per bulletin that are enabled and in the SQL query.
As you stated you could easily modify the targetted bulletins to match a single entry on the SQL or you could extend the script adding an input parameter to specify the bulletin you need and replace a variable in the SQL query definition.
I used this script last week and it worked as it always did (I had not used it for a year at least) so I ended up with 11GB of patches on my NS ;).
Ludovic FERRÉ
Principal Remote Product Specialist
Symantec
1st Rule of Connect Club: Mark the post that helped you the most as a 'solution'. 2nd Rule of Connect Club:You must talk about Connect
Very nice! Thanks!
Very nice! Thanks!
Great info thanks!
Great info thanks!
Still useful, even today.
Still useful, even today.
Would you like to reply?
Login or Register to post your comment.