-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script does not have logic to re-map a network drive when a UNC path is changed #49
Comments
@nicolonsky Any ideas mate? |
Hey @nicolonsky |
Also have questions regarding this, did you figure something out? |
Shouldn't line: |
The line: Get-PSDrive | Where-Object { $_.DisplayRoot -eq $drive.Path -or $_.Name -eq $drive.DriveLetter } | Remove-PSDrive -EA SilentlyContinue should remove inconsistent drive mappings when the script is updated. However Remove-PSDrive does not remove the mapping fully and you cannot add another mapping on the same drive letter in the same script. I did a quick fix in my code by commenting out that line and adding a good old net use command. $netUseDrive = $drive.DriveLetter + ":"
Write-Output "Deleting drive with with command: net use $netUseDrive /delete /y"
net use $netUseDrive /delete /y |
Check my reply: #31 (comment) |
1 similar comment
Check my reply: #31 (comment) |
How do I ensure that the script can handle updates to UNC paths?
Would I need to look at removing and disconnecting existing drives if the script needs to be rerun?
Thank you
The text was updated successfully, but these errors were encountered: