Qlik-Cli-Windows
Qlik-Cli-Windows copied to clipboard
New-QlikCustomProperties cannot run with Powershell objects from Json with Invoke-RESTmethod error.
I am trying to migrate custom properties using Qlik-Cli.
Situation: I have successfully exported all the custom properties using Get-QlikCustomProperty to a Json file. Now, I would like to import the same json file to a QMC for another environment (in a new Qlik Sense server). In the Json file, it has many blocks of keys-values for each QlikUsers by having their respective IDs, names, objectTypes, etc.
Failure encountered: (1) I cannot use the New-QlikCustomProperty Cmdlets in a ForEach loop, executing in Powershell ISE with administrator rights, by encountering Invoke-Restmethod's error.
(2) I cannot use the Import-QlikContents Cmdlets to import the Powershell objects that I have performed ConvertFrom-Json despite Qlik Sense connection is successful.
Question: Can I know what should I do to use Qlik-Cli module to import the Custom-Properties' contents in a Json file to a connected QMC from Powershell ISE since the New-QlikCustomProperties does not work. I am currently using the Qlik Sense Enterprise (not Cloud)?
When you call the Get-QlikCustomProperty ensure that you use the -raw parameter.
as an example the export script will look like this, you may need to adjust the file path and add any required filters on the get command
#Export to file
$QlikCustomProperties = Get-QlikCustomProperty -full -raw
$QlikCustomPropertiesJson = $QlikCustomProperties|ConvertTo-Json
$QlikCustomPropertiesJson|Out-File c:\temp\QlikCustomProperties.Json
transfer the out-file to the other environment and the following should work
#Import from file
$ImportedCPs = Get-Content c:\temp\QlikCustomProperties.Json|ConvertFrom-Json
$ImportedCPs |Import-QlikObject
Good day @Nillth ,
I have used the exact script that you have used above. However, I face the issue that I raised in this post. So, I provide you a picture to show you the error. I hope you could provide me with more insights.
Thank you for your reply.
Can you please confirm the Export process uses the -Raw command
@Nillth , Sorry for the late response. I have verified that the -Raw has been used in my Export script. Also, I face the same issue when executing other actions that 'import' other objects to the Qlik Sense server. So, My /qmc is not reflecting the presence of the new objects.