Creating a new SQL entry - Updating Linked Views

Sep 27, 2010 at 6:40 AM
Edited Sep 27, 2010 at 6:43 AM

Hi,

I am trying to take your webfront end one step further by creating a script that automatically populates MDT with existing computers.  It queries the local machine for UUID and computername then creates a new record for the machine in the MDT database.

This works perfectly at the moment. The problem is, and this occurs using the MDT web frontend, once the record is created, the linked view ComputerSettings isn't updated.

Through the MDTwebfrontend, the view is updated once you click on the new computers property button to view the computer details.  After I click the properties button through MDTwefrontend my script section that updates the fields in that view works. 

I am looking for a way to programatically update the ComputerSettings view using vbscript.  What is the code behind the Computer Properties button that updates the view?

Does anyone have any ideas?

Coordinator
Sep 29, 2010 at 10:13 AM
Edited Sep 29, 2010 at 10:15 AM

If you add a new computer to the database, there is no corresponding entry in the Settings table. That's why you don't see a anything in the ComputerSettings view in the database.

If you want to programmatically update the settings via vbscript you would need to update the "Settings" table in the Database, not the ComputerSettings view. A view can't be used for updating values. Or you use the webservice from MDTCustomizations (http://mdtcustomizations.codeplex.com/) which can be called easily by simple HTTP commands. In the background they would use stored procedures to execute the requested action.

Or you wait 1-2 months for the new version of the FrontEnd that will have all these webservices integrated and will not require any stored procedure.

 

Regards

Maik

Sep 29, 2010 at 11:22 PM

Thanks for the information MaikKoster.  Just one other question, if the description column is missing from the settings table, do I need to add the Description record to the ComputerIdentity table also?

Coordinator
Sep 30, 2010 at 8:52 AM

The "Description" column from the ComputerIdentity table is not populated to the "ComputerSettings" view on default. To have a "Description" column available in the settings views you would need to add this as a custom setting (column) to the Settings table and update the view definition with the built-in stored procedure sp_refreshview. Or add the custom setting using the web frontend that will do this for you.

You can also modify the ComputerSettings view to include the Description column of the ComputerIdentity table. This way the Description is only available for computers. So it depends on your requirements.

Regards

Maik