Deployment Solution

 View Only

Remove Computers from NS Database and DS Database with DS Job 

Apr 03, 2009 05:14 PM

When multiple people are reimaging and retiring computers it can become difficult to determine which machines should still remain in your database. I have determined that I only want active machines on our network to be in Altiris NS and DS so I have created a job to remove the computers from both databases once they are returned to stock.

This has helped us greatly in keeping our inactive inventory from our active inventory. The main downside to this method is you are also deleting all history to that machine.

This is how its done:

First, you will need to install the Microsoft SQL Server 2005 Command Line Query Utility on your DS server. You can get the SQL 2005 version here: http://www.microsoft.com/downloads/details.aspx?FamilyId=50b97994-8453-4998-8226-fa42ec403d17&displaylang=en

Here is the Microsoft documentation on how to use the SQLCMD tool: http://msdn.microsoft.com/en-us/library/ms162773.aspx

Once you have the query utility installed, create a DS job that will run from the DS server and not the client itself. To remove the record from the NS database, add a run script in your DS job with this command>

"C:\Program Files\Microsoft SQL Server\90\Tools\binn\SQLCMD.EXE" -U SQLUSER -P SQLPASSWORD -S SQLSERVER\SQLINSTANCE -d NSDATABASE -Q"DECLARE @guid uniqueidentifier; select @guid = Guid from vComputer where Name = '%COMPNAME%'; EXEC spResourceDelete @guid"

To remove the computer record from the DS server create another DS job to run from the DS server and not the client and add a run script with this command

"C:\Program Files\Microsoft SQL Server\90\Tools\binn\SQLCMD.EXE" -U SQLUSER -P SQLPASSWORD -S SQLSERVER\SQLINSTANCE -d DSDATABASE -Q "delete computer where name = '%COMPNAME%'"

This should allow you to remove records from both databases. Good Luck!

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Jan 16, 2012 07:10 AM

Hello. Doesn't this method leave items into the  dbo.nics  table and prevent the users in the future from entering the same machines (or new machines with the unfortunate same mac address) back again, because the mac addresses of the old computers are still listed in dbo.nics table?

 

Regards,

Mike

Apr 14, 2009 10:43 PM

Good post

Apr 04, 2009 12:32 PM

 

Related Entries and Links

No Related Resource entered.