I have a directory with hundreds of Hard Disk Image Files (.vhdx) - each containing user profile directory (C:\Users\xxx). When I click on a file using File Explorer, it is automatically mounted and I can access files inside. I have an issue with recreating the same with a command.
I do not know what is the username with given SID - I just need to modify a single file in each profile.
Example file: E:\profiles\UVHD-S-1-5-21-1614895754-1035525444-839522115-21214.vhdx
I've tried to use net use, dism and subst however I couldn't get any of those to work.
net useis for mapping SMB shares,dismis for working with .wim images,substis for mapping local paths to drive letters. Neither of them is suitable for working with VHD(X) files. Or claims to be, for that matter.In more recent Windows versions (starting with Windows 8 IIRC) you have cmdlets like
Mount-DiskImageorMount-VHDfor working with Hyper-V virtual harddisks. On Windows 7 you need to usediskpart.exe.Attach a virtual harddisk:
Detach a virtual harddisk: