I am trying to create an app that would setup bitlocker PIN Programmatically.
the app works as well as the PowerShell Command, However, I am unfortunately unable to execute it.
I am getting the following Error when Executing:
"Application Attempted to perform an operation not allowed by the security policy. To grant this application the required permissions, contact your system administrator or use Microsoft .Net Configuration Tool"
private void Submit_Click(object sender, EventArgs e)
{
if (PIN.Text.Length < 20)
{
MessageBox.Show("Passwords must be at least 20 characters long.");
return;
}
else if (PIN2.Text != PIN.Text)
{
MessageBox.Show("Password & Confirmation are not identical, Please ensure that both Passwords are the same");
return;
}
else
{
PowerShell ps = PowerShell.Create();
ps.AddCommand("$PIN = \"" + PIN.Text + "\" | ConvertTo-SecureString -AsPlainText -Force; Enable-BitLocker -MountPoint \"C:\" -PIN $PIN -TPMAndPinProtector -SkipHardwareTest");
ps.Invoke();
MessageBox.Show("Your Pre-Boot PIN has now been Setup - Please reboot after 30 Minutes and login with your PIN");
Application.Exit();
I have set assembly: SecurityRules(SecurityRuleSet.Level1) but issue remains.
is it a GPO that would need to be amended at all? or would i be able to bypass in the App somehow?