Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete and import servers
#1
I'm trying to delete and import servers. I can delete it by hand, and import it with a CSV file, but i like to do it with powershell.

I can connect to the environment.

$workingdir = "c:\Program Files (x86)\ASG-Remote Desktop 2018\"

Set-Location $workingdir
[Environment]::CurrentDirectory = Get-Location -PSProvider FileSystem

$path = $workingdir + "ASGRD-PSAPI.dll"

Add-Type -path $path
[reflection.assembly]::LoadFrom($path) | Import-Module

Connect-RDEnvironment -Environment 'ASGRD' -PassThrough

I can get the guid from the directorie i like to delete
Get-RDBaseItemId -ItemPath "Connections\WSUS\24-7\1:00"

But when i remove this directory it does nothing no error but als no deleting from the directory
Remove-RDBaseItem -ItemId 7c0c6e13-1b01-441d-9b6f-3de26b3728f5

Can someone tell me how i can remove all the directories after "24-7", "KA", "OTA" and PAT. If it is possible with a example. The direcories are not empty.

The second question is how can i bulkimport servers with Powershell, i have a CSV file.


Attached Files
.png   Structure.png (Size: 19.41 KB / Downloads: 2)
Reply
#2
For the Delete-Command you should have a command output like "Item removed successfully" or "Item could not be removed" - do you see anything like that?

Bulk import via Powershell is not implemented - but we will add it asap... (currently you can use command line import)
Regards/Gruss
Oliver
Reply
#3
I have seen that it is possible to use the command line to synchronise with a CSV file with the option

/syncsource:<filename>

/syncdeleteoption: <option> (Possible values: Delete, ShowIcon, Nothing)

But i cannot find the complete command line i have CSV files. Can you give me a example
Reply
#4
You can find an example in the help file - section command line options

Import of connection via csv file


Parameter

Description


/importaction:ConnectionsCsv

Starts an import of connections from a csv file


/importid:<id>

ID of the folder where the import should start from


/importsource:<filename>

Path to the csv file with connections


/importoutput:<Outputfile>

Path to the file where the import result should be written to


Example
◾c:\Program Files\ASG-RemoteDesktop 2018\ASGRD.exe /instance:MyEnvironment /loginintegrated:true /loginsubmit /importaction:ConnectionsCsv /importsource:c:\temp\connections.csv /importoutput:c:\temp\log.txt /importid:00000000-0000-0000-0000-000000000000
Starts the environment MyEnvironment, login with integrated account and executes import of connections.
Regards/Gruss
Oliver
Reply
#5
Thanx i can import the connection but only after i delete the existing connection, the same with the sync options.

Is there a way to remove in a certain directory all the connections.

I make every day a CSV file with mostely the same servers but sometime wit new and sometime a existing server is no longer active.
Reply
#6
If you would use the same directory for the import you can sepcify a csv-sync on that folder - activate the role and configure it - there you should be able to set the delete options for the import/sync - and you can call the sync by command line - just press the CommandLine-Button and you see the command
Regards/Gruss
Oliver
Reply
#7
Hello DevOma iyt is working
Reply




Users browsing this thread: 1 Guest(s)