6
0
I have a Windows 10 Pro PC, no domain, I don't use BitLocker on the system drive but have encrypted some fixed data drives using BitLocker and a password (no TPM).
When I like to unlock these drives I can select them in File Explorer and choose Unlock Drive...
, after entering my password the drive is decrypted and I can use it.
Because I have a few of these drives with the same password I wrote a script to unlock all them at the same time.
Unlock-BitLocker -MountPoint X: -Password $myPassword
This works fine when executed as an elevated administrator, but when I run the script as my normal standard user it fails:
Get-CimInstance : Access denied
WBEM_E_ACCESS_DENIED (0x80041003) Current user does not have permission to perform the action.
I assume both File Explorer and the PowerShell BitLocker module use the same Win32 API, why does one work as a standard user and the other one doesn't?
When using:
manage-bde –unlock E: -rp password
I get:
BitLocker Drive Encryption: Configuration Tool version 10.0.14393
ERROR: An attempt to access a required resource was denied.
Check that you have administrative rights on the computer.
Using Process Monitor, I can see access is denied to the following registry key:
HKLM\Software\Microsoft\WBEM\CIMOM
I also found out the File Explorer content menu calls the executable:
%systemroot%\System32\bdeunlock.exe
which displays the little popup window to enter the password.
When using bdeunlock.exe
no access to HKLM\Software\Microsoft\WBEM\CIMOM
is shown in Process Monitor. So it seems it unlocks the drive without accessing that key.
It looks that both the PowerShell cmdlets and manage-bde.exe
use WMI:
Get-CimInstance
-Namespace "root\cimv2\Security\MicrosoftVolumeEncryption"
-ClassName Win32_EncryptableVolume
and a standard user does not have access to this.
But bdeunlock.exe
may use the function FveOpenVolumeW
in FVEAPI.dll
(Bitlocker API file) directly without using WMI first.
Is there a way to unlock a Bitlocked fixed data drive on the command line as a standard user?
The permission File Explorer and PowerShell command prompt, have by default are different, which is the reason your script isn't working While the end result of the explorer menu item, Unlock Drive, and the PowerShell commandlet
Unlock-Bitlocker
are the same how they go about doing it is different. – Ramhound – 2016-09-22T14:46:54.667@Ramhound - I can see they're doing something different otherwise I wouldn't have this discrepancy. But I don't buy that they have different permissions, do you have any proof for that claim? – Peter Hahndorf – 2016-09-22T15:10:14.560
1My proof is my 20+ years of programming experience on Windows and understanding the default process permissions of both the PowerShell command prompt unles elevated and File Explorer and the exact nature of how that context menu works. I am not prepared to say, without a shadow of a doubt, it isn't possible to achieve what you want though. Which is the reason I have not submitted an answer saying, that what you want, is not possible. – Ramhound – 2016-09-22T15:12:39.977
Hmm, I’ve been programming on Windows NT for a bit longer than 20 years and this is the first time I hear that the permission of a shell context menu entry are different from a console app. I’m seriously curious why that would be. – Peter Hahndorf – 2016-09-22T15:20:22.190
That explaination would require more then 600 characters, likely around 1800 characters, and not something I am prepared to even attempt to do for another 48 hours. In a single sentence, its the difference between the PowerShell environment, and how the context menu interacts with
manage-bde.exe
– Ramhound – 2016-09-22T15:26:21.660Verify that in an non-elevated command prompt that,
manage-bde –unlock E: -rp password
unlocks the mounted drive without elevated permissions. If the drive letter isX
use that instead. – Ramhound – 2016-09-22T15:31:53.957@Ramhound - Thanks for your input so far, I added more details to the question, the suggested command also results in an access denied. – Peter Hahndorf – 2016-09-22T15:56:16.590
@Homey_D_Clown_IT - Thanks, but what you suggest just changes the way I call
Unlock-BitLocker
but in the end it runs the same cmdlet, and it gives me the sameAccess Denied
error. – Peter Hahndorf – 2016-09-25T08:37:00.533@Homey_D_Clown_IT - That just starts the script elevated which works but is exactly what I don't want to do. The question is how to do this as a standard user. – Peter Hahndorf – 2016-09-25T08:49:16.547
Pete - How about if you grant the standard user or some group they are in explicit access to the WMI path as you found from
– Pimp Juice IT – 2016-09-25T08:50:48.527wmimgmt.msc
.... would that satisfy your need if that would work doing it this way to allow the standard / non-local admin the ability to run the non-elevated script for access to theroot\cimv2\Security\MicrosoftVolumeEncryption
namespace? Look here: https://technet.microsoft.com/en-us/library/cc771551(v=ws.11).aspxLook at this screen shot for what I'm talking about for granting the standard user account explicit permission via
– Pimp Juice IT – 2016-09-25T08:58:00.730wmimgmt.msc
https://i.imgur.com/7HT4Udi.png@Homey_D_Clown_IT - Giving
execute methods
permission on the WMI object got me over the first access denied error. But then I got the next one. I'm currently debugging the BitLocker PowerShell module, I'm getting an access denied on the second KeyProtector. – Peter Hahndorf – 2016-09-25T09:24:38.823In the PowerShell BitLocker module, a standard user does not have access to the recovery password but to the normal password. So changing one line in the module now allows my standard user to unlock the drive. But of course this is not really an option. I could make a copy of that module and use it instead. And
yes
is not an option on my UAC prompt, I have to enter a long password as I am a standard user. But I see your point. I guess I will write an answer myself to explain all this. – Peter Hahndorf – 2016-09-25T09:46:09.960You could run your script as a scheduled task for after your logon, running as administrator – harrymc – 2016-09-25T18:07:30.193
@harrymc - that may work, but I don't want an automated unlocking of the bitlocked drives, I still want the user to enter the password. If running as scheduled task, I would have to store the whole password somewhere like in the credential manager of the administrator. The administrator should not even know the password for the bitlocked drives. – Peter Hahndorf – 2016-09-25T20:51:38.197
@Homey_D_Clown_IT - If you want the bounty, write a quick answer about the WIM permissions. It helped me finding a solution. – Peter Hahndorf – 2016-09-29T12:17:44.073