nicolonsky / IntuneDriveMapping

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

Question: Old script renamed to DriveMappping.ps1 #39

Closed Schnabulation closed 2 years ago

Schnabulation commented 2 years ago

Hi there...

This is a quick question: I have replaced the script DriveMapping.ps1 with a new version in InTune. The new script gets deployed perfectly fine but I have noticed that the already existing script on the endpoints gets renamed to DriveMappping.ps1 (with three "p" in the name).

This is not an issue with the script or its feature-set it's just that I could not find a function in the script that would be responsible for this renaming. Is this intended?

nicolonsky commented 2 years ago

The old generated scripts had a typo and contained three 'p' characters in the name. Newly genarated scripts do not have the typo present.

https://github.com/nicolonsky/IntuneDriveMapping/blob/687cbc35b6b65d26546ade3f2268947ac6aaf098/IntuneDriveMapping/wwwroot/bin/IntuneDriveMappingTemplate.ps1#L260


From: Steve Heller @.> Sent: Wednesday, May 4, 2022 2:23:42 PM To: nicolonsky/IntuneDriveMapping @.> Cc: Subscribed @.***> Subject: [nicolonsky/IntuneDriveMapping] Question: Old script renamed to DriveMappping.ps1 (Issue #39)

Hi there...

This is a quick question: I have replaced the script DriveMapping.ps1 with a new version in InTune. The new script gets deployed perfectly fine but I have noticed that the already existing script on the endpoints gets renamed to DriveMappping.ps1 (with three "p" in the name).

This is not an issue with the script or its feature-set it's just that I could not find a function in the script that would be responsible for this renaming. Is this intended?

— Reply to this email directly, view it on GitHubhttps://che01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnicolonsky%2FIntuneDriveMapping%2Fissues%2F39&data=05%7C01%7Cnicola%40nicolasuter.ch%7Cd51072c91cab4eebd72908da2dc8ee46%7C7955e1b3cbad49eb9a84e14aed7f3400%7C1%7C0%7C637872638256468868%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XDxwQBvUEg82YSHOpUpaP5K7eVTw1wg3wdAn7sqJTH0%3D&reserved=0, or unsubscribehttps://che01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAH3AFKVNR4TVYW7UDSDZG2LVIJT45ANCNFSM5VBZUQ7A&data=05%7C01%7Cnicola%40nicolasuter.ch%7Cd51072c91cab4eebd72908da2dc8ee46%7C7955e1b3cbad49eb9a84e14aed7f3400%7C1%7C0%7C637872638256468868%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ZsfO9gEW1bZ4f2WIwmZaefpmeoOHtWrTx3uHy%2BPAVk0%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Phenix51 commented 2 years ago

I had added a small section to my drivemapping script to removal of the old scheduled tasks when I had updated this prior to the old generated script being updated.

`$taskname = "IntuneDriveMapping","InTuneDriveMapping"

foreach ($task in $taskname) { $taskExists = Get-ScheduledTask | Where-Object {$_.TaskName -like $task } If ($taskExists) { #Removes the Scheduled Task in queue Unregister-ScheduledTask -TaskName $task -Confirm:$false Write-Host "The Scheduled Task $task has been removed." } else { Write-Host "The Scheduled Task $task did not exist." }`

I wasn't concerned about the initial script since it wasn't being called by a scheduledtask any longer, but you could certainly have it built into your version of the script to search and remove the old DriveMappping.ps1 file if it exists on your user's PC.

Schnabulation commented 2 years ago

Ah I see - this makes sense, thank you!