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

MapNetworkDrive connect using different credentials #36

Closed Thetecher closed 2 years ago

Thetecher commented 2 years ago

How to modify script to include the ability to map a drive and connect to it using different credentials? Thank you for your time

nicolonsky commented 2 years ago

@Thetecher storing credentials in a script is agains any kind of secure practise. Better integrate your NAS or fileserver into Active Directory via LDAP.

willembeens commented 2 years ago

I agree it is not very secure, but you can add a line around line 240, after the 'Done' section. cmd.exe /C "cmdkey /add:"servername.domain.local" /user:"localhost\username" /pass:"Password123"" As far as I saw that piece of code isn't copied to the local computer.

I'm not sure if it works. At the first test it seems to work but a few tests later it seems that it doesn't work anymore. Therefore I tested to fill in the credential by a separate script, that works.