Git Product home page Git Product logo

snipeitsyncps's People

Contributors

blighter avatar mattcarras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

snipeitsyncps's Issues

Creating existing item then failing

I'm using Sync-ADUsers.ps1 without any changes outside of the 'configuration' options, and am seeing strange behaviour.
The script seems to find a department or company but then goes on to try and create it anyway, obviously failing

.\Sync-ADUsers.ps1 -EmailDeletedUsersReport
Transcript started, output file is .\Logs\snipeit-ad-sync_2023-11-16.log
VERBOSE: [2023/11/16 11:55:21] Connecting to Snipe-It instance at []
VERBOSE: [Get-SnipeItEntityAll] Collecting all existing [users] from Snipe-It...
VERBOSE: [Get-SnipeItEntityAll] Got back 315 results for [users]
VERBOSE: [Get-SnipeItEntityAll] Collecting all existing [companies] from Snipe-It...
VERBOSE: [Get-SnipeItEntityAll] Got back 4 results for [companies]
VERBOSE: [Get-SnipeItEntityAll] Collecting all existing [departments] from Snipe-It...
VERBOSE: [Get-SnipeItEntityAll] Got back 54 results for [departments]
VERBOSE: [Get-ADUsersByGroup] Collecting all users from AD group [
] (Nested=True, With FilterMap=False)...
VERBOSE: [Get-ADUsersByGroup] Getting properties for 215 users...
VERBOSE: [Get-ADUsersByGroup] Total filtered AD users collected: 215
VERBOSE: [Get-ADUsersByGroup] Collecting all users from AD group [] (Nested=True, With FilterMap=False)...
VERBOSE: [Get-ADUsersByGroup] Getting properties for 63 users...
VERBOSE: [Get-ADUsersByGroup] Total filtered AD users collected: 63
[2023/11/16 11:55:53] Formatting users...
[2023/11/16 11:55:55] Starting sync...
VERBOSE: [Sync-SnipeItUser] Processing user [
] with employee_num [***]
Write-Error: ***\Documents\PowerShell\Modules\SnipeitPS\1.10.227\Public\New-SnipeitCompany.ps1:68:23
Line |
68 | $result = Invoke-SnipeitMethod @parameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| name ---- {The name has already been taken.}
Sync-SnipeItUser: \Sync-ADUsers.ps1:428:24
Line |
428 | … $sp_user = Sync-SnipeItUser -User $user -Verbose @extraParams
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| [Get-SnipeItEntityByName] Fatal ERROR creating new snipeit companies with name [
]! Returned entity has invalid ID
Sync-SnipeItUser: \Sync-ADUsers.ps1:428:24
Line |
428 | … $sp_user = Sync-SnipeItUser -User $user -Verbose @extraParams
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| [Get-SnipeItEntityByName] Fatal ERROR creating new snipeit departments with name [
]! Returned entity has invalid ID

I tried to use the functions to mimic the behaviour and have been successful:

Get-SnipeItDepartment | ?{$_.Name -eq "IT"}

id : 88
name : IT
phone :
fax :
image :
company :
manager :
location :
users_count : 0
created_at : @{datetime=2023-11-16 12:17:57; formatted=2023-11-16 12:17 PM}
updated_at : @{datetime=2023-11-16 12:17:57; formatted=2023-11-16 12:17 PM}
available_actions : @{update=True; delete=True}

Get-SnipeItDepartmentByName -Name "IT"
OperationStopped: ...\Snipeit-Sync-PS.ps1:1030:21
Line |
1030 | … Throw [System.Net.WebException] ("[Get-SnipeItEntityByNam …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| [Get-SnipeItEntityByName] Fatal ERROR creating new snipeit departments with name [IT]! Returned entity has invalid ID

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.