Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Conversion failed when converting value to data type #4

Closed
Ioan-Popovici opened this issue Feb 28, 2019 · 6 comments
Closed

Conversion failed when converting value to data type #4

Ioan-Popovici opened this issue Feb 28, 2019 · 6 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Projects

Comments

@Ioan-Popovici
Copy link
Member

@Yevrag35

Running the report gives me:
conversionfailed
How do I begin debugging this?

@Ioan-Popovici
Copy link
Member Author

I have a lot of reports, which one are you refering to?

@Ioan-Popovici Ioan-Popovici self-assigned this Feb 28, 2019
@Ioan-Popovici Ioan-Popovici added this to To in SCCM Zone via automation Feb 28, 2019
@Ioan-Popovici Ioan-Popovici added bug Something isn't working question Further information is requested labels Feb 28, 2019
@Yevrag35
Copy link

Oh sorry, it's the "CB Configuration Baseline Compliance by Configuration Item with Values" one.

However, a colleague and I found the issue, we believe. The ID's in the error correspond with 'AdminIDs' for Administrative users in SCCM. And the issue only happens to users who are members of multiple groups and/or specified explicitly in the administrative users section in the console.

In my case, my user account was explicitly defined as an admin AND I am a member of another group which is also defined as an admin in the console. The error is actually coming from the definition of 'UserSIDs'.

My user's UserTokenSIDs as it passes into 'dbo.fn_rbac_GetAdminIDsfromUserSIDs' results in two ID's coming back from the function. But instead of Microsoft listing them as 2 separate values, they concatenate them into one string joined with a comma.

Workaround:
Remove the duplicate Administrative User entry.

Fix?:
My colleague wrote some simple T-SQL to automatically split the string (if it needs to), and select the first ID in the newly created array. This is, more than likely, not ideal as it's not checking for the highest permissions levels.

@Ioan-Popovici
Copy link
Member Author

Hmm, I will look for a workaround, thanks for reporting this

@Ioan-Popovici Ioan-Popovici added good first issue Good for newcomers and removed question Further information is requested labels Feb 28, 2019
@Yevrag35
Copy link

No problem, when I get into work, I will post the extra code that got it working.

@Ioan-Popovici
Copy link
Member Author

Ioan-Popovici commented Mar 6, 2019

For now the simple workaround is to uncomment this line
--DECLARE @UserSIDs AS NVARCHAR(250) = 1;
If it does not work you might need to replace the value with 'Disabled'

NOTE: This will disable the report security!

Ioan-Popovici pushed a commit that referenced this issue Mar 14, 2019
## 4.0 2019-03-14

### Changes

    * Speed optimisations
    * Workaround for issue [Conversion failed when converting value to data type](#4)
    * Added 'Compliant' Data
    * Changed OS Caption to static
    * Removed system info temporary table
    * Replaced report template with the new streamlined template
    * Changed report description to static
@Ioan-Popovici
Copy link
Member Author

Implemented workaround, upgraded report template and other optimisations.
Released v4.0

SCCM Zone automation moved this from To to Done Mar 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers
Projects
No open projects
SCCM Zone
  
Done
Development

No branches or pull requests

2 participants