Open
Conversation
* Get-SnipeItEntityAll: - Add missing "fields" entitytype to Get-SnipeItEntityAll. - Include archived assets by default. Use new -ExcludeArchivedAssets switch to change behavior. * Sync-SnipeItAsset: - Add -UpdateArchivedStatus "<status>" parameter. - Display a warning if updating asset with archived status_type unless -UpdateArchivedStatus is given. - Refetch asset after successful update due to Snipe-It issue #11725. * Remove-SnipeItInactiveEntity - New function. Deletes unassigned/unused entities of given supported types (models, departments, etc.).
- Add support for -UpdateArchivedStatus (commented out by default). - When exporting assets to CSV, make sure all properties are exported and set a default order for some built-in fields. - Change EMAIL_ERROR_REPORT_TO to support multiple addresses.
- Add script parameter switches: -DisableSync, -AdSyncDeletedUsersPurge, -EmailDeletedUsersReport - Added an option for emailing a report on deleted/inactive users. - Tweaked logic for dealing with deleted/inactive users. Also made a requirement for either $AD_SYNC_ON_EMPLOYEE_NUM=$true or checking for ldap_import enabled in all target groups. - Purging/emailing a report on deleted users can now be done with script parameter switches, allowing one to schedule this differently than the main sync. By default, only flag & report on deleted users. - Tweaked emailed reports to handle sending to multiple recipients.
Add info on new functions.
- For proper error handling, when updating or creating an entity, throw an error if the returned value does not have a valid ID. This is required because SnipeitPS doesn't always return an error code for all error types. - If an error state is reached when updating or creating users or assets, always show the parameters even if -Debug is not given. - Don't throw errors in Sync or Remove functions that loop over entities, just write out the results. - Remove -Debug and -Verbose from propagated parameters as they're already inherited by default.
- Add LogFilePrefix "<prefix>" script parameter. This can be used when running the script for other tasks, like cleaning up or reporting on deleted users. - Fixed syntax error in deleted users section. - Add attachment when emailing out error report.
Tweak error report.
- Allow syncing passwords with Sync-SnipeItUser. - Make sure passwords are redacted when optionally outputting given parameters in Sync-SnipeItUser.
--- Replaced all instances of possibly incompatible .NET exceptions with custom exceptions.
--- Select-SnipeItFilteredEntity: Fixed logic, should work properly now.
--- Get-SnipeItEntityAll: Only warn/error on duplicate model names that lack a unique model_number (for jamf2snipe, etc.).
--- Sync-SnipeItDeptUsers: Fixed logic, should work properly now.
--- Sync-SnipeItUser: Make sure password is also redacted on update too.
--- Sync-SnipeItAsset: Added -DontSyncAssetTag switch to allow updating the asset tag.
--- Sync-SnipeItAsset: Added following switches: -DefaultAssignedStatus <status>, -AllowAssignNonDeployableStatus, -DontCreateModelIfNotFound, -DontCreateCategoryIfNotFound, -DontCreateManufacturerIfNotFound.
--- Sync-SnipeItAsset: Fully handle assigning assets using assigned_id or assigned_to fields to users, assets, or location IDs (must exist prior). Default status of -DefaultAssignedStatus <status> will override -DefaultCreateStatus <status>, if both are given. The status must be of status_type 'deployable' unless -AllowAssignNonDeployableStatus is given. The required checkout_to_type field will default to 'user' if not given.
--- Sync-SnipeItAsset: To avoid confusion, assigned_to and assigned_id are now interchangeable. checkout_to_type will default to 'user' but accepts "user_id", "asset_id", and "location_id" for assigning to snipe-it IDs.
--- Sync-SnipeItAsset: Add -ErrorOnMissingFields switch (default behavior is to output to Write-Verbose).
--- Sync-SnipeItAsset: Add -DateFormat parameter, which defaults to the format required by Snipe-It ('yyyy-MM-dd'). Only affects custom fields. Give $null to disable.
--- Sync-SnipeItAsset: Various tweaks and fixes.
Add support for assigning assets to users. Also a few minor tweaks and fixes.
Fix and reformat deleted users report as HTML. Also a couple minor tweaks.
Example script for updating assets using an imported CSV file, emailing results to file's owner by default.
* Get-SnipeItEntityAll: Added -ReturnValues parameter. * GetSnipeItSupplierByName: Fixed function logic. * Sync-SnipeItUser: Various fixes and tweaks. * Remove-SnipeItInactiveUsers: Fixed empty count. * Sync-SnipeItDeptUsers: Added -RestrictCompany and -SkipEmptyCompany parameters. * Sync-SnipeItAsset: Added logic for handling assigning assets and setting the "expected_checkin" field. Also improved log output. * Format-SnipeItAsset: Added -AddDepartmentID and -WarnOrphanChain parameters. * Update-SnipeItInactiveUserReassignment: New function to reassign assets from inactive users to departmental users.
Various tweaks and fixes for consistency.
Various tweaks and fixes, mainly around exporting assets.
Moved reassignment logic into Update-SnipeItInactiveUserReassignment and a few other tweaks.
--- Improved documentation --- Update-SnipeItInactiveUserReassignment: Added fix for inactive reassignable users count showing as blank in logs. --- Updated Sync-SnipeItDeptUsers with new -Departments parameter. --- Sync-SnipeItAsset: Added -SkipArchived parameter. This will skip syncing assets with the "archived" meta status. --- Added "Unable to connect to the remote server" to $SNIPEIT_RETRY_ON_STATUS_CODES. --- Added $SNIPEIT_SUCCESS_STATUS_CODES. --- Added $SNIPEIT_ALWAYS_RETRY ($true by default). This will always retry regardless of status code unless the code is in $SNIPEIT_SUCCESS_STATUS_CODES. --- Added REST error checking and retries to Update-SnipeItInactiveUserReassignment --- Minor variable name changes --- Added support for $SNIPEIT_RETRY_UPDATE_INVALID_ID, which treats an invalid ID returned by the Set command as a failure and retries up to the limit. --- Made sure errors referencing invalid IDs always print all the error info. --- Fix for errors when retrying a Set command that returned an invalid ID. --- Replace instances of API fields "assigned_to" and "assigned_type" with "assigned_user", "assigned_asset", and/or "assigned_location"
- Improved error handling - Improved documentation - Added runtime stats logging - Added support for separate settings file - Fixed script incorrectly purging active users after receiving errors attempting to query group membership by added additional error catching and -ExitOnError switch to function. The -ExitOnError switch should always be set to true when the option to purge users is enabled. - Added fix for reassignment count incorrectly showing or evaluating as 0 if it contains only 1 user. - Added support for mapping AD fields to ScriptBlocks in $AD_GROUP_PROPERTY_MAP for advanced mapping needs. - Added support for $AD_SYNC_DEPARTMENT_USERS_FROM_AD_DEPARTMENTS and $AD_SYNC_DONTCREATECOMPANY settings. - Dept Users sync is now skipped if -DisableSync is set or $ENABLE_SYNC is set to $false. - Dept Users sync is now in a try/catch. - Reworked Get-ADUsersByGroup to try and fix problems with Get-ADGroupMember occasionally timing out, and Get-ADGroup returning non-users. Also changed some other parameters, like the filtering. - Moved the "Delete reassigned user" logic into one try/catch. - Fix issue when users are synced from more than one AD group. Now the logic will correctly merge the results of the groups, ldap_import, and activated built-in fields. - Export all columns for snipeit_ad_deleted_users.csv. - Do not send $AD_SYNC_DEPARTMENT_USERS_RESTRICT_COMPANY in -DepartmentalUserCompany when calling Update-SnipeItInactiveUserReassignment, as $AD_SYNC_DEPARTMENT_USERS_RESTRICT_COMPANY is intended for filtering from AD and not Snipe-It and may give incorrect results.
- Improved error handling - Improved documentation - Added runtime stats logging - Added support for separate settings files - Added support for AD_IMPORT_PLATFORMS, AD_IMPORT_EMPTY_PLATFORM, SCCM_IMPORT_PLATFORMS, SCCM_IMPORT_EMPTY_PLATFORM. This fixes issue #22 where an AD-bound Mac in the SCCM export with a blank model was trying to use the default PC model and giving an error. - Added support for "OS Version" field, taken from SCCM or AD imports
Disables assets that match criteria for "Assigned User Deleted" (user deleted from sync). Loads settings from Snipeit-Asset-Sync-Settings.ps1 and Snipeit-Disable-DeletedUser-Systems-Settings.ps1.
- Improved error handling - Improved documentation - Added runtime stats logging - Added support for separate settings files - Added additional sanity checks if the import file given is blank, or there are no valid imported assets in the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge all changes from develop that have been tested in a live environment.