Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Powershell csv sync
#1
I'm having trouble using the Powershell command NewRDBaseItemImportCsv.

The concept is simple; our master list of hosts is in a csv file that I want to sync to the VisionApp database whenever it changes.  In order to do this, I wrote a Powershell script that calls the command above anytime the csv file changes.

This works fine for new or existing hosts, but it doesn't seem to sync deleted ones.  For instance, if I remove a line in the csv file and call the command (even with the -sync and -overwrite parameters), it doesn't delete a host that has been removed.  There are no errors in the log.

Any ideas?  I am using ASG Remote Desktop 2019.
Reply
#2
Yes I can see that the DeleteOption for this CmdLet is hardcoded - and set to "Do nothing" instead of "Delete objects" - will be enhanced with the next version to specify the right behavior...
Regards/Gruss
Oliver
Reply
#3
(02-03-2021, 10:36 AM)DevOma Wrote: Yes I can see that the DeleteOption for this CmdLet is hardcoded - and set to "Do nothing" instead of "Delete objects" - will be enhanced with the next version to specify the right behavior...

Can anyone confirm if this has been fixed?
Reply
#4
Yes it is!
Regards/Gruss
Oliver
Reply
#5
Is there an example how to do this? It still doesn't seem work for me. When I remove a line from MyFile.csv and run the following command, nothing is changed when I re-open the database.

$BaseItem = Get-RDBaseItemId -ItemPath "Connections\MyNode"
New-RDBaseItemImportCsv -ItemId $BaseItem.Guid -CsvFilename "MyFile.csv" -OutputFilename c:\temp\sync.txt -sync -overwrite
Reply
#6
Can't test it currently but the command should look like this

$BaseItem = Get-RDBaseItemId -ItemPath "Connections\MyNode"
New-RDBaseItemImportCsv -ItemId $BaseItem.ItemId -CsvFilename "MyFile.csv" -OutputFilename c:\temp\sync.txt -sync -overwrite -DeleteOption Delete
Regards/Gruss
Oliver
Reply
#7
And I see that documentation of the new parameter is missing - will also be added...
Regards/Gruss
Oliver
Reply




Users browsing this thread: 1 Guest(s)