You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error message: ModelValidationFailure a type name that is incompatible with the metadata. The value specified its type as 'microsoft.management.servic es.api.win32LobAppRegistryRequirement', but the type specified in the metadata is 'microsoft.management.services.api.win32LobAppDetection'.
#136
AVERTISSEMENT : An error occurred while creating the Win32 application. Error message: ModelValidationFailure: A value was encountered that has a type name that is incompatible with the metadata.
The value specified its type as 'microsoft.management.services.api.win32LobAppRegistryRequirement', but the type specified in the metadata is 'microsoft.management.services.api.win32LobAppDetection'.
`
Here is the script I use (tests with PS 5.1 and 7.3.0):
I'm curious as well what's not working here. I suspect that the input object for the DetectionRule parameter is causing this issue. Could you test with a default, from the samples, object and see if the app gets created then? That will confirm if I'm on the right track here.
So no use of splatting but full line: $DetectionRule = New-IntuneWin32AppDetectionRuleRegistry -Check32BitOn64System $false -KeyPath "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MyApp\EnhancedTags\GeoLoc" -StringComparisonOperator equal -StringComparison -ValueName Country -StringComparisonValue $CountryCode
Hello,
I encounter this error and I don't know how to solve this. Coudl you help me please ? Did I make a mistake ?
Thank you
`
COMMENTAIRES : Access token refresh is not required, remaining minutes until expiration: 52
COMMENTAIRES : Attempting to gather additional meta data from .intunewin file: myapp.intunewin
COMMENTAIRES : Successfully gathered additional meta data from .intunewin file
COMMENTAIRES : Start constructing basic layout of Win32 app body
COMMENTAIRES : Constructed the basic layout for 'EXE' Win32 app body type
COMMENTAIRES : Detection rule objects passed validation checks, attempting to add to existing Win32 app body
COMMENTAIRES : Retrieving default set of return codes for Win32 app body construction
COMMENTAIRES : Adding array of return codes to Win32 app body construction
COMMENTAIRES : Attempting to create Win32 app using constructed body converted to JSON content
COMMENTAIRES : POST https://graph.microsoft.com/Beta/deviceAppManagement/mobileApps
AVERTISSEMENT : An error occurred while creating the Win32 application. Error message: ModelValidationFailure: A value was encountered that has a type name that is incompatible with the metadata.
The value specified its type as 'microsoft.management.services.api.win32LobAppRegistryRequirement', but the type specified in the metadata is 'microsoft.management.services.api.win32LobAppDetection'.
`
Here is the script I use (tests with PS 5.1 and 7.3.0):
`
MSGraph connection infos
$Tenant = '0123-456-789-0123-4567-8901'
$ClientID = '0123-456-789-0123-4567-8901'
$ClientCert = (Get-ChildItem "Cert:\CurrentUser\My" | Where-Object { $_.Subject -like "Cblablablabla" })
$ClientCertThumbprint = $ClientCert.Thumbprint
Retrieve CountryCode
$RootPath = "C:\Temp\Intune\Sources"
#$ScriptName = $RootPath + "" + "MyAweSomeScript.ps1"
#$ScriptNamewoExt = "MyAweSomeScript"
#$CSVFile = $null
#$CSVFile = Import-Csv "$RootPath\ListofTagsToApply-Groups.csv" -Delimiter ";"
Set-Location $RootPath
$CountryName = $_.CountryName
$CountryCode = "CL"
$ScopeID = "31"
Package as .intunewin file
$SourceFolder = "C:\Temp\Intune\Sources"
$SetupFile = "MyAweSomeScript.ps1"
$OutputFolder = "C:\Temp\Intune\Output"
$Win32AppPackage = New-IntuneWin32AppPackage -SourceFolder $SourceFolder -SetupFile $SetupFile -OutputFolder $OutputFolder -Verbose -Force
#$IntuneWinFile = "C:\Temp\Intune\Output\MyAweSomeScript.intunewin"
Get meta data from .intunewin file
$IntuneWinFile = $Win32AppPackage.Path
$IntuneWinMetaData = Get-IntuneWin32AppMetaData -FilePath $IntuneWinFile
App properties
$DisplayName = "Apply Country code [$CountryCode] in registry"
$Description = "[$CountryCode] Set 2 registry keys to be used for tagging asset"
$Publisher = "MeAndMeJustMe"
$AppVersion = "v1.0.0"
$Developer = "MeAndMeJustMe"
$Owner = "MeAndMeJustMe"
#$Notes = ""
#$InformationURL = ""
#$PrivacyURL = ""
[boolean]$CompanyPortalFeaturedApp = $false
#$CategoryName = ""
$InstallExperience = "system"
$RestartBehavior = "suppress"
#[Int]MaximumInstallationTimeInMinutes = ""
Add new EXE Win32 app
$InstallCommandLine = "powershell.exe -ExecutionPolicy Bypass -File .\MyAweSomeScript-$CountryCode.ps1"
$UninstallCommandLine = "cmd.exe /c"
Create requirement rule for all platforms and Windows 10 20H2
$RequirementRule = New-IntuneWin32AppRequirementRule -Architecture "x64" -MinimumSupportedWindowsRelease "W10_1607"
$DetectRulesParam = @{
"Check32BitOn64System" = $false
"KeyPath" = "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MyApp\EnhancedTags\GeoLoc"
"ValueName" = "Country"
"StringComparison" = $true
"StringComparisonOperator" = "equal"
"StringComparisonValue" = $CountryCode
}
$DetectionRule = New-IntuneWin32AppRequirementRuleRegistry @DetectRulesParam
Convert image file to icon
$ImageFile = "C:\Temp\Intune\Sources\MyLogo.png"
$Icon = New-IntuneWin32AppIcon -FilePath $ImageFile
Connect MS Grapah
Connect-MSIntuneGraph -TenantID $Tenant -ClientID $ClientID -ClientCert $ClientCert
Creating app
$params = @{
"FilePath" = $($IntuneWinFile)
"DisplayName" = $($DisplayName)
"Description" = $($Description)
"Publisher" = $($Publisher)
"AppVersion" = $($AppVersion)
"Developer" = $($Developer)
"Owner" = $($Owner)
"InstallExperience" = $($InstallExperience)
"RestartBehavior" = $($RestartBehavior)
"DetectionRule" = $($DetectionRule)
"RequirementRule" = $($RequirementRule)
#"ReturnCode" = $($ReturnCode)
"InstallCommandLine" = $($InstallCommandLine)
"UninstallCommandLine" = $($UninstallCommandLine)
"Icon" = $($Icon)
"CompanyPortalFeaturedApp" = $CompanyPortalFeaturedApp
}
Add-IntuneWin32App @params -Verbose -Debug
#Assignement
$Win32App = Get-IntuneWin32App -DisplayName $DisplayName -Verbose
$GrpID = (Get-MgGroup -Filter "DisplayName eq '$CountryCode-Devices'").id
Add-IntuneWin32AppAssignment -ID $Win32App.ID -GroupID $GrpID -GroupMode Include -Notification hideAll -Intent required -Target Group -Verbose
`
The text was updated successfully, but these errors were encountered: