Access official resources from Carbon Black experts
use das set nocount on -- -------------------------------------------------------------------------------------------- -- Description: -- 1. Remove prioritization of upgrades; and expire selected hosts session -- -------------------------------------------------------------------------------------------- -- Step 1: declare variables declare @cnt int; declare @max int; declare @tbl table (id int identity, host_id int) -- Step 2: get hosts to remove prioritization of upgrades INSERT INTO @tbl (host_id) SELECT host_id FROM dbo.hostmain h WITH (NOLOCK) WHERE deleted = 0 AND upgrade_state < 0 -- forced upgrade requested through the menu (0x80000000) SELECT @max = max(id), @cnt= 1 from @tbl ; -- Step 3: loop; each host (and expiring the host) while (@cnt <= @max) begin declare @hostID int; select @hostID = host_id from @tbl where id = @cnt; print convert(varchar(3), @cnt) + ' host id: ' + convert(varchar(30), @hostID); -- Change Upgrade State UPDATE dbo.hostmain SET upgrade_state=16 --Not requested WHERE host_id = @hostID -- Expire host EXEC dbo.ExpireHostSession @hostID; -- Update counter set @cnt = @cnt + 1; end
Copyright © 2005-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.