Jump to content

Steve G

Hornbill Developer
  • Posts

    748
  • Joined

  • Last visited

  • Days Won

    31

Everything posted by Steve G

  1. Hello everyone, We've released v1.16.0 of the Database Asset Import Utility. This release requires Service Manager build 2241 or above. Features Added support for importing Software Asset Management records when creating or updating assets Improved logging, including: grouping log details per-asset; basic log details added to instance log Added version check against Github repo Changes Optimised import process, including the local caching of Hornbill asset records for each class & type Refactored code to remove duplicated & unnecessary code Rounded time taken output to the nearest second Fixes Removed a number of possible race conditions when using multiple workers This can be downloaded from Github, and is documented on the Hornbill Wiki.
  2. Hi @Martyn Houghton, This has now been released, and requires the Service Manager update that was released last night: It's pretty basic in this release - it only supports deleting Contacts and Organisations whose IDs are provided. Additional filtering options will arrive in due course, but that will require some additional changes to the Core app. Cheers, Steve
  3. @Izu, This has now been released, and requires the Service Manager update that was released last night: Cheers, Steve
  4. Hello everyone, We've just released v.1.16.0 of the Hornbill Cleaner Utility. This release requires Service Manager build 2241 or above. Changes Updates to cater for move of Configuration Manager into Service Manager Features Added support to filter Requests for deletion by Catalog ID Added support to delete Service Availability records, filtered by Service ID(s) Added support to delete Contact records Added support to delete Organization records Added version check against Github repo Enhanced debug logging, now logs request and response payloads when an API call into Hornbill fails This can be downloaded from Github, and is documented on the Hornbill Wiki.
  5. Hi @Martyn Houghton, I'll add this to the list, it would also be useful in the other import tools that use JSON config. In the mean time, you could always use something like https://codebeautify.org/jsonvalidator, or an IDE like Visual Studio Code, to check the validity of the JSON. Cheers,
  6. Hi @Izu, The code is written, and we're waiting on the next Service Manager update before release. This should be in about a weeks time. Cheers, Steve
  7. Hi @Izu, That's not currently possible, and would require changes to both the cleaner tool and Service Manager. I'll add it to the list and will let you know when we've had chance to have a look. Thanks, Steve
  8. Hi @BillP, No worries. Although if you're using smGetReqDetails2, you don't actually need the additional call to getRequestRecord, as smGetReqDetails2 provides an activity stream accessToken in the output params, as well as the activity stream ID in the requestDetails output param Cheers, Steve
  9. Hi @BillP, You can use the activityStreamQuery API to pull paginated lists of posts (and optionally comments) from a requests timeline, using an access token and activity stream ID returned by a call to the getRequestRecord API. The activity stream ID will be returned in the h_activity_stream_id column within the primaryEntityData output parameter of getRequestRecord. Let me know if you need any more info. Cheers, Steve
  10. Hi @Martyn Houghton, The code looks ok, I think the issue may be with the delete - deleting the file from the session before attachFileFromSession can perform its logic. I've looked at the Service Manager code behind attachFileFromSession, and it actually handles the delete from the session for you, so performing the delete in your code is unnecessary. I knocked up a very basic example PHP script, using your example from above, and had it attach 1000 images to a request, and all 1000 were successful: <? $image_path = "/Users/steveg/Pictures/me_new.jpg"; for ($x = 0; $x < 1000; $x++) { $file_name = "me_new".$x.".jpg"; $url = "https://hhq-p01-api.hornbill.com/stevegdev/dav/session/" . $file_name; uploadFile($url, $image_path); attachFileToRequest($file_name); } function uploadFile($url, $image_path) { $image_handler = fopen($image_path, 'rb'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: ESP-APIKEY myapikey' )); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_INFILE, $image_handler); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($image_path)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_exec($ch); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo "[UPLOAD] [".$http_status."] [".$url."] [".$image_path."]\n"; curl_close($ch); } function attachFileToRequest($file_name) { $ch = curl_init(); $url = "https://hhq-p01-api.hornbill.com/stevegdev/xmlmc/apps/com.hornbill.servicemanager/Requests?method=attachFileFromSession"; $request_id = "IN00013698"; $file_in_session = "/session/".$file_name; $data = '<methodCall service="apps/com.hornbill.servicemanager/Requests" method="attachFileFromSession"> <params> <requestId>'.$request_id.'</requestId> <fileName>'.$file_in_session.'</fileName> <description>some file description</description> <visibility>trustedGuest</visibility> </params> </methodCall>'; curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 15, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => array( 'Authorization: ESP-APIKEY myapikey', 'Content-Type: text/xmlmc', 'Accept: application/json' ), )); $result = curl_exec($ch); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); $json_response = json_decode($result); $hornbill_api_status = $json_response->{'@status'} ? 'true' : 'false'; echo "[ATTACH] [".$http_status."] [". $hornbill_api_status ."] [".$file_name."]\n"; curl_close($ch); } ?> And the 1000 attachments against the request: Hope this helps, Steve
  11. @Izu The query is extracting data from your SCCM tables, so this won't be a Hornbill task - somebody from your organisation (your SCCM administrator, or DBA) should update and test the query for you, and you can then update the mapping in your own config from there. Thanks, Steve
  12. Hi @Izu, Apologies, but I'm not entirely sure what your query is. Could you please expand a little on what it is you're trying to achieve and hopefully we'll be able to assist? Many thanks, Steve
  13. Hi @vhayer and @MattZ, Apologies for the delay in responding, I've been on annual leave. The issue here is that you're providing the entire URL to the web frontend for your instance in the instanceName variable, instead of just the instance name. So for example, if your instance was called myinstance, you are currently setting: instanceName = "https://live.hornbill.com/myinstance/" When this should actually read: instanceName = "myinstance" Hope this helps, Steve
  14. Hi @vhayer, That error is likely due to an incorrect value in the instanceName varible (row 2, attached), meaning that the script can't access your instance details to proceed: Note, the instance ID is case sensitive. Kind regards, Steve
  15. Hi @Martyn Houghton, The process would be: HTTP POST the file to the users session folder in dav, providing the API key in the header in the same was as you do for other API calls: https://mdh-p01-api.hornbill.com/yourinstanceid/dav/session/yourfilename.png Make an API call to apps/com.hornbill.servicemanager/Requests::attachFileFromSession as below to attach the file HTTP DELETE the file from the users session folder (same URL as above) <methodCall service="apps/com.hornbill.servicemanager/Requests" method="attachFileFromSession"> <params> <requestId>IN00012345</requestId> <fileName>/session/yourfilename.png</fileName> <description>some file description</description> <visibility>trustedGuest</visibility> </params> </methodCall> Hope this helps, Steve
  16. Hi @AndyGilly, The preferred method to do what you need is: Write-Output "{{SISJobOutputParameterStart:MoverADGroups}}$($output){{SISJobOutputParameterEnd}}" Note the use of a subexpression $($output), this will ensure your variable is printed as you would expect, in the event it's not of type string. Cheers, Steve
  17. @AndyGilly The operation is now documented, here: https://wiki.hornbill.com/index.php?title=Active_Directory_User_Management Cheers, Steve
  18. Morning @AndyGilly, Great stuff There actually already is a Get operation in the AD User Management package, I just appear to have forgotten to document it on the Wiki... I'll correct that this morning! Cheers, Steve
  19. Hi @Jeremy, This would suggest your form is not submitting its data - e is an object that should contain the form response when your Form project trigger runs the onSubmit action: So this will be an issue with your Google Form configuration, probably in the project triggers... Cheers, Steve
  20. Hi @Paul Alexander, This would require a small change in Service Manager to be able to add this feature to the cleaner tool - I'll add it to the list, but if you're after a quick fix you could always export a list of references for the requests you wish to delete, and add them to the RequestReferences array in the cleaner config. With this set and CleanRequests set to true, running the tool will delete just those requests (and related records). Hope this helps, Steve
  21. Hi @BillP, There's a good example of how to manage this requirement within the LDAP Import tool, in the userImageUpdate function from the image.go file you have linked above. The process is basically: HTTP PUT the file into the session folder in dav, with the link (replacing yourinstanceid and thefilename as appropriate ): https://mdh-p01-api.hornbill.com/yourinstanceid/dav/session/thefilename.jpg Use activity::profileImageSet to apply the profile image, where sourceImage would be /session/thefilename.jpg HTTP DELETE the file from your session folder in dav, with the link from the PUT. This is to ensure your session folder doesn't end up being full of unnecessary files. Note, the HTTP PUT and HTTP DELETE need authenticating, so you'll need to provide the API Key for the user you are using in the Authorization header, in the same manner as you would for making XMLMC API calls into Hornbill. With regards to the profileImageGet output, you can get these images via https://mdh-p01-api.hornbill.com/yourinstanceid/dav/_static/img/thevalueofimageReference_theimageresolution.jpg So for example, if you had a user profile with an image reference of 50/0000002698, and you wanted the image with a resolution of 512x512, then your url would be: https://mdh-p01-api.hornbill.com/yourinstanceid/dav/_static/img/50/0000002698_512x512.jpg As always, you will need a valid session, or API key, to get at those images. Supported resolutions are: 16x16 24x24 32x32 54x54 64x64 128x128 200x200 220x264 256x256 512x512 Note, you don't need to update the image in these resolutions, the userProfileSet API takes care of the resize/cropping for you. Hope this helps, Steve
  22. HI @Samantha Melville, The Intune to Hornbill asset import script can be installed via the Runbook Gallery in Azure Automation: Note, this requires the Hornbill modules to be installed from the Modules Gallery: Thanks, Steve
  23. Hi @AndyGilly, This is posssibly due to the default ErrorAction for the cmdlet in question not being Stop. I've seen examples where the error is output to the CLI and the script continues as normal, even when in a try-catch. If the cmdlet you are using supports it, then set the -ErrorAction Stop argument (either directly in the command line, or by splatting the param(s) in a hash table, example below). This will ensure the error can be caught and handled gracefully. try { $Params = @{ Name = $Name ErrorAction = "Stop" WarningVariable = "warnings" WarningAction = "SilentlyContinue" } Start-VM @Params } catch { Write-Output "{{SISJobOutputParameterStart:errors}}$($_.Exception.Message){{SISJobOutputParameterEnd}}" Write-Output "{{SISJobOutputParameterStart:outcome}}FAIL{{SISJobOutputParameterEnd}}" Exit 0 } Cheers, Steve
  24. Hi @AndyGilly, Yes, I've added this to the list. Will let you know when it hits the top Cheers, Steve
×
×
  • Create New...