Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.
DISCLAIMER
All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.
Cireson does not and will not support or maintain these enhancements, extensions, and scripts.
For Team Cireson uploads click here.
PowerShell module to query the Cireson Portal (CiresonPortalPS)
Hope you find it useful!
Unfortunately I changed of employers so I don't have access to the Cireson Portal anymore and can't develop further. Contributions are more than welcome!
Comments
Works fine for me.
I gather you ran Set-CiresonPortalPSConfiguration first?
Love this PS gallery offering.
I would really like to see it extended at some point to include getting and updating Type Projections at some point if possible.
Using your module as an example, I just wrote "Get-CiresonPortalProjection.ps1" to pull projection data,
and "Commit-CiresonPortalProjection.ps1" which essentially enables us to update projections via 'api/V3/Projection/Commit'.
I have attached them to this post.
Notice that "Get-CiresonPortalProjection.ps1" contains a parameter called: 'ReturnDuplicateCopy'. When set to true, this will force the function to return the same result, but instead of only returning one PSCutomObject with all related JSON data, it returns two copies as part of an array object. The main reason I did this is because it can be quite tricky in powershell to copy one PSCutomObject over to another without bringing over references from the original object.
The main purpose of copying / duplicating the JSON object is to be used with Commit-CiresonPortalProjection.ps1, which compares the two objects to figure out what the differences are, so that the required changes can be applied.
The '$($result | ConvertTo-Json -depth 100 | ConvertFrom-Json)' command successfully gets around this issue, but this wouldn't be an obvious solution to most.
Both functions seem to work pretty well. please check them out and if you happy, please add them into the gallery.
Cheers
Adrian
There was an issue where the JSON string was being truncated, so I had to change | ConvertTo-JSON to | ConvertTo-JSON -depth 100
This ensures you can apply changes right down through the hierarchy of relationships.
Unfortunately I changed work and don't have access to Cireson Portal anymore.
Do you want me to add your functions to the module on github ? or do you want to take care of it and make a Pull request ?
https://github.com/lazywinadmin/CiresonPortalPS
I can then publish a new version onto the PowerShell Gallery
That would be great!
I Just tried to add a pull request, but I cant seem to do it for some reason, the button to create one is greyed out.
I am happy to upload the changes, but don't have access. my GitHub username is axpae.
Otherwise, I am happy if you want to upload the changes.
Regards,
Adrian
In order to contribute, you need to fork the repo under you user, then update the code. Once this is done you can create a Pull request.
If you are not familiar with this process, I will take care of it this week-end
Thanks again for your help
I updated the branch 'dev' of the repository: https://github.com/lazywinadmin/CiresonPortalPS/tree/dev/CiresonPortalPS
Note that I changed the name of Commit-CiresonPortalProjection to Update-CiresonPortalProjection and gave you credits to in the .NOTES of each functions.
Question/request for you:
For Get-CiresonPortalProjection
-Where and How can a user retrieve a TypeProjectionId ? Is there a way to retrieve all the types ?
For Update-CiresonPortalProjection
-Can you give an example of usage ? I see in the Comment Based help of the function you provided the following example: Update-CiresonPortalProjection -OrigionalData $orig -CurrentData $new
How would you get $Orig and $new ? (just need the syntax to put it in the example)
Ive just made some other minor updates.
I have figured out how to create a fork now, so I will do that.
I will add in the comments as requested.
I also added in additional parameter in 'Update-CiresonPortalProjection' called runConcurrencyCheck
Also,
Where you have the following code in the various functions...
TRY{
Write-Verbose -Message $(New-ScriptMessage -Block BEGIN -message 'Checking Pre-Requisites')
Get-CiresonPortalPSConfiguration -WarningAction Stop
}
CATCH
{
# Stop the function
break;
}
I have had to change this to:
TRY{
Write-Verbose -Message $(New-ScriptMessage -Block BEGIN -message 'Checking Pre-Requisites')
Get-CiresonPortalPSConfiguration -WarningAction Stop
}
CATCH
{
# Stop the function
Throw "Not Connected to Cireson Portal"
}
The main reason, is that I need to detect when the connection has timed out (when an exception is thrown), so that I can re-connect, but I only want to reconnect when required. If that makes sense..
With a break; I cant detect this, because it does not throw an exception.
I will make a fork and add these change in. Feel free to adjust it if you wish.
Cheers,
Adrian
So, not sure if I didn't this correctly, but I have tried to add two pull requests:
axpae-Get-CiresonPortalUser:
'Get-CiresonPortalUser' has already been written, but was missing from the list of available functions to import.
and
axpae-FunctionUpdates:
Update-CiresonPortalProjection.ps1:
- Added '-Force' Switch
- Improved Help / Examples.
Get-CiresonPortalProjection.ps1:
- Added '-ReturnDuplicateCopy' Switch
- Improved Help / Examples.
For all other functions, added line:
Throw "Not Connected to Cireson Portal"
... To help with error handling.
What I did was download your latest Dev version and made the changes to that dev version.
Unfortionately, when I did the fork request, it would only let me do it against the master prod version, so in axpae-Get-CiresonPortalUser you will notice that ModuleVersion = '1.0.0.2'.
I did quite a bit of testing, so code should be fine.
Adrian
I see two branches on your repository with those names but I did not receive pull requests.
I compare the two but something is off... did you change the encoding of the files ? It looks like all the files coming from your repo are different :-/
No I didn't change the encoding :-/
I really don't know how to fix it. Any chance you can sort it?
Am kind of new to this GitHub thing (obviously)
I have attached the latest code if that helps.
I have also added 'Get-CiresonPortalEnumDisplayName.ps1'
Which allows for retrieving of Enum Display names. I created a fork and uploaded the file, otherwise I have attached it here.
https://github.com/lazywinadmin/CiresonPortalPS/tree/dev
Can you download it and give it a shot ?
https://github.com/lazywinadmin/CiresonPortalPS/archive/dev.zip
Then I'll merge with master and upload to PowerShell Gallery
Thanks again for your help
For some reason all of the amendments have not come across into dev.
Amendments required:
- Add 'Get-CiresonPortalUser' to line 69 in CiresonPortalPS.psd1
- Add the latest versions of Update-CiresonPortalProjection and Get-CiresonPortalProjection.
- Ensure that functions throw exception when not connected, rather then just 'breaking'. e.g.:
Throw "Not Connected to Cireson Portal"
I have re-attached all functions and required amendments.
Thanks again.
Adrian
Almost.
There was a typo in "Get-CiresonPortalRequestOfferingTop.ps1". Was just missing a bracket.
I have fixed it in the attached, I have also included one additional function "Get-CiresonPortalObjectHistory"
If you could include this one aswell that would be much appreciated.
I am pretty confident we don't need to test again, you should be good to go with putting it into production now.
Regards,
Adrian
Heya LazyWinAdmin.
Any chance we could get the final version uploaded?
Thanks again!,
Adrian
Hi.
To hopefully make things a bit easier, I have created another fork with all ammendments so that changes can be easily committed.
I have thoroughly tested this version.
If can be viewed here:
https://github.com/axpae/CiresonPortalPS/tree/axpae-FunctionUpdates
and downloaded here for testing here:
https://github.com/axpae/CiresonPortalPS/archive/axpae-FunctionUpdates.zip
I tried to create a pull request against your "Dev" fork, but I don't have access to upload files to Dev, hence why I had to create a separate fork.
If you could commit these changes, that would be much appreciated.
Kind Regards,
Adrian
Thanks again for your help, I will add some changes soon as well, make sure to pull the last version if you want to provide any pull request.
Thanks.
I went to re-install CiresonPortalPS... Uninstall-Module CiresonPortalPS, Install-Module CiresonPortalPS, etc, but its still loading the old version? Any ideas..?
Regards,
Adrian
https://www.powershellgallery.com/packages/CiresonPortalPS/1.0.0.2
Just tested, all works find now! Thanks for that..
Regards,
Adrian