Micke-K / IntuneManagement

Copy, export, import, delete, document and compare policies and profiles in Intune and Azure with PowerShell script and WPF UI. Import ADMX files and registry settings with ADMX ingestion. View and edit PowerShell script.
MIT License
1.12k stars 200 forks source link

Failed to save file due to path length limitations #184

Open jjrmilner opened 9 months ago

jjrmilner commented 9 months ago

I have picked up several configuration profiles which are not exporting.

It looks like the combination of the tenant name and the fact that the profiles have long names (almost near the Intune GUI limit.).

Here is an example:

Export Settings Catalog: CIS-EDGE-D-I: 1.50 (L1) Ensure 'Automatically import another browser's data and settings at first run' is set to 'Enabled: Disables automatic import, and the import section ... (90/579) Failed to save file C:\Intune\Global Micro Solutions\SettingsCatalog\CIS-EDGE-D-I 1.50 (L1) Ensure 'Automatically import another browser's data and settings at first run' is set to 'Enabled Disables automatic import, and the import section _24b3d7d8-9533-469d-8b5f-77e5881c4a52.json Exception: Could not find a part of the path 'C:\Intune\Global Micro Solutions\SettingsCatalog\CIS-EDGE-D-I 1.50 (L1) Ensure 'Automatically import another browser's data and settings at first run' is set to 'Enabled Disables automatic import, and the import section _24b3d7d8-9533-469d-8b5f-77e5881c4a52.json'. File not found: C:\Intune\Global Micro Solutions\SettingsCatalog\CIS-EDGE-D-I 1.50 (L1) Ensure 'Automatically import another browser's data and settings at first run' is set to 'Enabled Disables automatic import, and the import section ..._24b3d7d8-9533-469d-8b5f-77e5881c4a52.json. Could not add assignments to file.

jjrmilner commented 9 months ago

As a test, I unchecked the options to "include object type", and "include tenant name". This effectively shortens the save path.

After making the change, there are no save errors in the logs.

jjrmilner commented 9 months ago

I still get "File not found errors" eg

File not found: C:\Intune\SettingsCatalog\CIS-OFFICE-U-I 2.5.14.3.11 (L1) Ensure 'Configure Outlook object model prompt When accessing the Formula property of a UserProperty object' is set to 'Enabled ..._2d8e328f-e17f-4952-88d2-af9f93c27816.json. Could not add assignments to file.

The files does save, CIS-WINBL-D-I 18.9.7.1.6 (BL) Ensure 'Prevent installation of devices using drivers that match these device setup classes.zip

jjrmilner commented 9 months ago

After some additional testing, this issue seems to be an assignments export problem - not a save problem. If I disable exporting assignments, there is no error. Please let me know if we should open a second issue ?

Micke-K commented 9 months ago

Hello,

I did some testing and it is a mix of the 260 path limit and a bug caused by policy name ends with dots.. Since the file is over 260 characters, it fails to create the json. When it then tries to add the assignments to it since the file does not exist.

That must be the longest Intune policy name I've ever seen! I might look at this in the future but for now I leave that part as a know limit. There are lot of functions that uses the same way so it be a fair bit of redesign to fix it.

For the other part, try the updated modules in the attached. I didn't do much testing so I hope it doesn't break anything else.

Cheers!

MSGraph.zip

jjrmilner commented 9 months ago

Thank you

JJ Milner Managing Director @.**@.> Tel: +27 (11) 7310600 | Fax: +27 (11) 7310601 | Mobile: +2783 602 6601 5th Floor, Global House, 28 Sturdee Ave, Rosebank, PO Box 2174 Parklands 2121

To access encrypted emails & documents, download the Azure Information Protection Clienthttps://www.globalmicro.co.za/information-protection/ and Adobe Acrobat Readerhttps://www.globalmicro.co.za/information-protection/.

@.https://www.globalmicro.co.za/ @.https://www.globalmicro.co.za/ @.***

From: Mikael Karlsson @.> Sent: Tuesday, January 9, 2024 10:19 AM To: Micke-K/IntuneManagement @.> Cc: JJ Milner @.>; Author @.> Subject: Re: [Micke-K/IntuneManagement] Failed to save file due to path length limitations (Issue #184)

Hello,

I did some testing and it is a mix of the 260 path limit and a bug caused by policy name ends with dots.. Since the file is over 260 characters, it fails to create the json. When it then tries to add the assignments to it since the file does not exist.

That must be the longest Intune policy name I've ever seen! I might look at this in the future but for now I leave that part as a know limit. There are lot of functions that uses the same way so it be a fair bit of redesign to fix it.

For the other part, try the updated modules in the attached. I didn't do much testing so I hope it doesn't break anything else.

Cheers!

MSGraph.ziphttps://github.com/Micke-K/IntuneManagement/files/13870925/MSGraph.zip

- Reply to this email directly, view it on GitHubhttps://github.com/Micke-K/IntuneManagement/issues/184#issuecomment-1882594866, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOHM6KZTA27TXR6WTDRHNGLYNT4NTAVCNFSM6AAAAABBRSH5POVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSGU4TIOBWGY. You are receiving this because you authored the thread.Message ID: @.**@.>>

jjrmilner commented 9 months ago

Hi Micke

Are you open to doing paid consulting work - we have several Microsoft MVPs who collaborate on interesting projects.

If so, please share your contact information and we can discuss what we are working on.

Thanks JJ

Micke-K commented 9 months ago

Hello!

I don't think that would be possible but send me an IM on X.

Cheers!

jjrmilner commented 9 months ago

Will do

Get Outlook for iOShttps://aka.ms/o0ukef

JJ Milner Managing Director @.**@.> Tel: +27 (11) 7310600 | Fax: +27 (11) 7310601 | Mobile: +2783 602 6601 5th Floor, Global House, 28 Sturdee Ave, Rosebank, PO Box 2174 Parklands 2121

To access encrypted emails & documents, download the Azure Information Protection Clienthttps://www.globalmicro.co.za/information-protection/ and Adobe Acrobat Readerhttps://www.globalmicro.co.za/information-protection/.

[cid:gms-logo-20190110_318d7958-f9b9-4bb9-a64a-3a1d50b292ad.gif]https://www.globalmicro.co.za/ [cid:gms-signature-animated-banner_db1d1d32-991c-44aa-948a-c53060ab7447.gif] https://www.globalmicro.co.za/ [cid:f1730c93-e39b-4cdc-9c17-1cdebc038f35.jpg]


From: Mikael Karlsson @.> Sent: Wednesday, January 10, 2024 2:14:13 PM To: Micke-K/IntuneManagement @.> Cc: JJ Milner @.>; Author @.> Subject: Re: [Micke-K/IntuneManagement] Failed to save file due to path length limitations (Issue #184)

Hello!

I don't think that would be possible but send me an IM on X.

Cheers!

— Reply to this email directly, view it on GitHubhttps://github.com/Micke-K/IntuneManagement/issues/184#issuecomment-1884736823, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOHM6K2GYT6MGX473XFCAPDYN2AZLAVCNFSM6AAAAABBRSH5POVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUG4ZTMOBSGM. You are receiving this because you authored the thread.Message ID: @.***>