nicolonsky / IntuneDriveMapping

Generate PowerShell scripts to map network drives on Intune managed Windows 10 devices
https://intunedrivemapping.azurewebsites.net/
MIT License
148 stars 17 forks source link

Intune Powershell Script Execution Reporting as "Failed/Error" #12

Closed CJHarms closed 4 years ago

CJHarms commented 4 years ago

Hi there,

I have a small Bug Report regarding the Execution Reporting of the Powershell Script in the Intune Web UI. The Powershell Script is executed successfully on the Clients and for te Users and all the needed Drives are mapped (fantastic work on the Script by the way!) but in the Intune Web UI all the Devices and Users are getting Reported as Error/Failed.

I'm guessing that somehow the Exit Codes from the Script are not the ones Intune expects them to be or they need to be implemented. Would be great if you could fix/implement this when you got the time.

Thanks in advance and thanks for the fantastic Script!

CJHarms commented 4 years ago

Almost forgot: If you need more Information or Logs for Troubleshooting or something else feel free to contact me and I'll try to help where I can.

nicolonsky commented 4 years ago

Hi @CJHarms sorry for the late reply but I've been on vacation. Could you try to replace line #150 in your script with the following: Get-ChildItem -Path HKCU:\Network -ErrorAction SilentlyContinue | ForEach-Object {New-ItemProperty -Name ConnectionType -Value 1 -Path $_.PSPath -Force -ErrorAction SilentlyContinue} and see if it helps?

CJHarms commented 4 years ago

Hi @nicolonsky took me also some time to test your proposed Fix but I can report that it fixed the Issue for me.

I see you already commited the new Code in your Commit a5baa4fa06da8c28d99a6a964eb485e4f912aac8

Thanks for the quick help! Keep up the good work and stay safe and healthy.

nicolonsky commented 4 years ago

@CJHarms thanks for the feedback. Yes changes are already pushed to code / the online version of the tool. Cheers and stay save & healthy too.