Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
teddyh2o
Engaged Sweeper
we need to import about 1000 non computer devices and wanted to assign those devices to individual users with AD.
Is that possible?
2 REPLIES 2
prighi61
Engaged Sweeper III
Once you bulk loaded the assets from the csv into tblAssets, you can create a user relation record between each asset having a Username+Userdomain to its user this way:

Set IDENTITY_INSERT [lansweeperdb].[dbo].[tblAssetUserRelations] ON
GO

DECLARE @offset integer;
set @offset = (Select Max(RelationID) + 1 from [lansweeperdb].[dbo].[tblAssetUserRelations]);

insert into [lansweeperdb].[dbo].[tblAssetUserRelations] (
[RelationID],[Username] ,[Userdomain] ,[AssetID] ,[Type] ,[Comments] ,[Lastchanged] ,[StartDate] ,[EndDate] ,[Ou] ,[AdObjectId] ,[IsLocalUser])
select ROW_NUMBER() OVER(PARTITION BY NULL ORDER BY AssetID) + @offset as RelationID,
a.Username,
a.Userdomain,
a.[AssetID],
12 as Type,
null as Comments,
GETDATE() as Lastchanged,
null as StartDate,
null as EndDate,
null as Ou,
null as AdObjectId,
case a.FQDN
when null then 1
else 0
end as IsLocalUser
FROM [lansweeperdb].[dbo].[tblAssets] a
Where Username > ''

Set IDENTITY_INSERT [lansweeperdb].[dbo].[tblAssetUserRelations] OFF
GO
teddyh2o
Engaged Sweeper
ended up using SQL query.

General Discussions

Find answers to technical questions about Lansweeper.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now