Posted: Mon Sep 12, 2011 10:02 am Post subject: Automatically delete device in WDM
Hi
In WDM 4.8.5, does anybody know if it's possible to automatically delete devices that haven't checked in for a specific amount of time, rather than doing it manually?
There is no automatic function doing this for you.
But you can use some SQL queries and call these from inside SQL on a regular base.
You can create your own stored procedure like that one:
Code:
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[sp_DeleteInactiveDevices]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].sp_DeleteInactiveDevices
GO
CREATE PROCEDURE [dbo].sp_DeleteInactiveDevices
@InactiveDays int
AS
BEGIN
DECLARE @ClientID int
DECLARE @DeviceList CURSOR
SET @DeviceList =CURSOR FOR
SELECT ClientID
FROM [RapportDB].[dbo].[Client]
WHERE DATEDIFF(day, CheckIn, getdate()) >= @InactiveDays
AND AgentVersion <> '5.0.0.15'
AND AgentVersion <> '5.0.0.17'
OPEN @DeviceList
FETCH NEXT FROM @DeviceList INTO @ClientID
WHILE (@@FETCH_STATUS = 0)
BEGIN
EXEC sp_DeleteClient @ClientID
FETCH NEXT FROM @DeviceList INTO @ClientID
END
CLOSE @DeviceList
DEALLOCATE @DeviceList
END
GO
CG _________________ Try the free Configuration Generator to generate your ini files for WTOS, Linux v6, Linux v7, Ubuntu, Viance or create CE addon packages *** Don't forget to donate via PayPal if you like it *** http://www.technicalhelp.de
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum