EndpointSecurity "WARNING: Specified method is not supported."
Description
After your awesome demo yesterday (again thanks), I tried to test on one of our test tenants, where I have the Global Administrator role. However if I use the reporting function without a filter it fails to report specific settings. If you think what a mess, this is my second issue ever haha.
Steps to reproduce
Build-IntuneConfigReport -Tenant x.onmicrosoft.com -OutputFolder .\Folder\
"WARNING: Specified method is not supported."
The endpoint security bit is here https://github.com/tabs-not-spaces/Intune.Reporting/blob/096cef7a952500e733523d227ef1d6a59ae08ac1/Intune.Reporting/Public/Build-IntuneConfigReport.ps1#L147-L185
In the loop after Get-EndpointSecurityPolicyDetailsa a few of the $s have no $s.displayName (when I run it):
It throws on this specific line
https://github.com/tabs-not-spaces/Intune.Reporting/blob/096cef7a952500e733523d227ef1d6a59ae08ac1/Intune.Reporting/Public/Build-IntuneConfigReport.ps1#L169
This occurs in my test tenant on the following settings:
- deviceConfiguration--windows10EndpointProtectionConfiguration_smartScreenEnableInShell Friendly name= "Allows IT Admins to configure SmartScreen for Windows."
- deviceConfiguration--windows10GeneralConfiguration_appManagementMSIAllowUserControlOverInstall Friendly name= "Allow user control over installs"
- deviceConfiguration--windowsIdentityProtectionConfiguration_enhancedAntiSpoofingForFacialFeaturesEnabled Friendly name= "Boolean value used to enable enhanced anti-spoofing for facial feature recognition on Windows Hello face authentication."
- deviceConfiguration--windows10GeneralConfiguration_appManagementMSIAlwaysInstallWithElevatedPrivileges Friendly name= "Always install with elevated privileges"
What is odd that these are not all endpoint security policies
Everything works fine if I leave the endpointSecurityPolicy out of it
Build-IntuneConfigReport -Tenant x.onmicrosoft.com -OutputFolder .\Folder\ -Filter admx,autopilot,deviceCompliance,deviceConfiguration,enrollmentStatus,office365,scripts,win32Apps
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
get-module Intune.Reporting,msal.ps,newtonsoft.json
Script 1.0.0.305 Intune.Reporting Build-IntuneConfigReport
Script 4.14.0.1 msal.ps {Add-MsalClientApplication, Clear-MsalTokenCache, Enable-MsalTokenCacheOnDisk, Get-MsalAccount…}
Script 1.0.2.201 newtonsoft.json {ConvertFrom-JsonNewtonsoft, ConvertTo-JsonNewtonsoft}
Debug output
Build-IntuneConfigReport -Tenant x.onmicrosoft.com -OutputFolder .\Folder\ -Debug
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code [code] to authenticate.
Grabbing configuration.. ☕
ADMX Policies: 2 items found.
AutoPilot Policies: 4 items found.
Compliance Policies: 6 items found.
Configuration Policies: 35 items found.
EndpointSecurity Policies: 2 items found.
EnrollmentStatus Policies: 1 item found.
PowerShell Scripts: 9 items found.
Office365 applications: 3 items found.
Win32 applications: 6 items found.
Generating Report: Endpoint Security Policies WARNING: Specified method is not supported.
Report Generated: .\Folder\\x.onmicrosoft.com\x.onmicrosoft.com_report.md 🍻
Error output
Exception :
Type : System.NotSupportedException
TargetSite :
Name : ThrowTerminatingError
DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation, Version=7.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
StackTrace :
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Message : Specified method is not supported.
Source : System.Management.Automation
HResult : -2146233067
CategoryInfo : InvalidArgument: (:) [Select-Object], NotSupportedException
FullyQualifiedErrorId : DictionaryKeyMissingValue,Microsoft.PowerShell.Commands.SelectObjectCommand
ErrorDetails : The Name key has no value.
InvocationInfo :
MyCommand : Select-Object
ScriptLineNumber : 169
OffsetInLine : 52
HistoryId : 24
ScriptName : C:\Users\ChristianPiet\OneDrive - Company\Documenten\PowerShell\Modules\Intune.Reporting\1.0.0.305\Public\Build-IntuneConfigReport.ps1
Line : $tmp.jsonResult = $s | Select-Object @{ Name = $s.DisplayName; Expression = { $_.valueJson | ConvertFrom-Json } } | ConvertTo-Json -Depth 10
PositionMessage : At C:\Users\ChristianPiet\OneDrive - Company\Documenten\PowerShell\Modules\Intune.Reporting\1.0.0.305\Public\Build-IntuneConfigReport.ps1:169 char:52
+ … sult = $s | Select-Object @{ Name = $s.DisplayName; Expression = { $_ …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\ChristianPiet\OneDrive - Company\Documenten\PowerShell\Modules\Intune.Reporting\1.0.0.305\Public
PSCommandPath : C:\Users\ChristianPiet\OneDrive - Company\Documenten\PowerShell\Modules\Intune.Reporting\1.0.0.305\Public\Build-IntuneConfigReport.ps1
InvocationName : Select-Object
CommandOrigin : Internal
ScriptStackTrace : at Build-IntuneConfigReport, C:\Users\ChristianPiet\OneDrive - Company\Documenten\PowerShell\Modules\Intune.Reporting\1.0.0.305\Public\Build-IntuneConfigReport.ps1: line 169
at <ScriptBlock>, <No file>: line 1
Suggestion
I tried setting the name to the definitionId that does enable me to finish the cmdlet without the filter and get the results (while skewed with the different name. This could a not so swell way to let the script finish.
if (!$s.DisplayName) {
$s.DisplayName = $s.definitionId
}
Another way I think this coulde be solved is by creating a switch statement capturing all the specific definitionIds with custom definitions, but that'd be a bit laborintensive.
switch ($s.definitionId){
"deviceConfiguration--windows10EndpointProtectionConfiguration_smartScreenEnableInShell" {
$s.displayName = "Allows IT Admins to configure SmartScreen for Windows."}
"deviceConfiguration--windows10GeneralConfiguration_appManagementMSIAllowUserControlOverInstall" {
$s.displayName = "Allow user control over installs"}
"deviceConfiguration--windowsIdentityProtectionConfiguration_enhancedAntiSpoofingForFacialFeaturesEnabled" {
$s.displayName = "Enable enhanced anti-spoofing for facial feature recognition on Windows Hello face authentication."}
"deviceConfiguration--windows10GeneralConfiguration_appManagementMSIAlwaysInstallWithElevatedPrivileges" { $s.displayName = "Always install with elevated privileges"}
Default {}
}
PS: sorry for the spaces in the code, the browser doesn't support tabs :(.
Feel like doing a PR on this?
On Sat, 1 Aug 2020, 5:15 am Manbearpiet, [email protected] wrote:
Reopened #4 https://github.com/tabs-not-spaces/Intune.Reporting/issues/4 .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tabs-not-spaces/Intune.Reporting/issues/4#event-3609905985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDA4LNRKOAWTI6MVTQ2F3TR6MJ6LANCNFSM4OW4UAFQ .
Sorry I derped in the github app, I missclicked and closed it. Will suggest a PR next week ;).
Op za 1 aug. 2020 04:07 schreef Ben R. [email protected]:
Feel like doing a PR on this?
On Sat, 1 Aug 2020, 5:15 am Manbearpiet, [email protected] wrote:
Reopened #4 < https://github.com/tabs-not-spaces/Intune.Reporting/issues/4> .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/tabs-not-spaces/Intune.Reporting/issues/4#event-3609905985 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AIDA4LNRKOAWTI6MVTQ2F3TR6MJ6LANCNFSM4OW4UAFQ
.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/tabs-not-spaces/Intune.Reporting/issues/4#issuecomment-667452080, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKPUQKL25HBVQSTPWGLF7HLR6N2HPANCNFSM4OW4UAFQ .
Sorry to wake this up after two years, i can see that it is still a challenge or did i do it wrong by installing the module, using the PSGallery?