I'm working on a script which remaps a users' DVD drive to another drive letter... I have the script all working (using DISKPART) and it's brilliant... as long as you are an administrator! One of the checks when re-assigning, is to make sure that the drive letter isn't already used... again - this works as administrator (under own profile).
This causes a bit of a problem when trying to run on a normal users' PC...
jbloggs1 is logged in... and wants to have his DVD re-mapped to Z:... but as he's just a user, he can't use the DISKPART command. My script would check... and notice that he's already got his Z: drive mapped to \\server\share\folder1 so couldn't proceed...
Now... because he doesn't have permission - I need to have permission, so run the app as "adminuser1". But this then looks at the "mapped drives" of adminuser1... rather than "jbloggs1" so won't provide a warning!
Is there any way that I can have the app running as "adminuser1" but seeing the mapped drives of "jbloggs1"?
(Note that logging the user off or changing their permissions is NOT an option!)