Index
  Random Headlines
  Who's Online
There are currently, 88 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here
Technicalhelp and Freewysemonkeys: Forums

Freewysemonkeys :: View topic - Automatically delete device in WDM
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automatically delete device in WDM

 
Post new topic   Reply to topic    Freewysemonkeys Forum Index -> WDM/Rapport
View previous topic :: View next topic  
Author Message
phillary
Newbie
Newbie


Joined: Nov 05, 2010
Posts: 4

PostPosted: Mon Sep 12, 2011 10:02 am    Post subject: Automatically delete device in WDM Reply with quote

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?

Thanks

Phil
Back to top
View user's profile Send private message
ConfGen
Jedi Master
Jedi Master


Joined: Apr 20, 2007
Posts: 5708
Location: Germany

PostPosted: Mon Sep 12, 2011 12:56 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Freewysemonkeys Forum Index -> WDM/Rapport All times are GMT + 1 Hour
Page 1 of 1

 

Jump to:   
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

Powered by phpBB © 2001-2008 phpBB Group