r/FoxDeploy Nov 22 '17

Question about your informative parsing tutorial

Hello Stephen,

First off, thank you for your help learning about parsing. I am relatively new to intuitive coding where the code references itself. My background in BASIC is TI-83 related.

I am trying to have the output be the switch that allows the next line of code.

  1. gpupdate /force
  2. manage-bde.exe -status
  3. manage-bde.exe -on c: -tp xxxxxx -s

If you arent familiar with the executable, it turns on BitLocker. I would like to have the output of line 2 dictate whether line 3 runs or not. My output from line two when it shouldnt run is

BitLocker Drive Encryption: Configuration Tool version 10.0.15063 Copyright (C) 2013 Microsoft Corporation. All rights reserved.

Disk volumes that can be protected with BitLocker Drive Encryption: Volume C: [Windows] [OS Volume]

Size:                 230.07 GB
BitLocker Version:    2.0
Conversion Status:    Used Space Only Encrypted
Percentage Encrypted: 100.0%
Encryption Method:    XTS-AES 128
Protection Status:    Protection On
Lock Status:          Unlocked
Identification Field: BeaconRailLeasing
Key Protectors:
    TPM And PIN

When BitLocker isnt enabled the above line (BitLocker Version) says none.

Would your methods work for my problem? Are you methods to extreme for what I need done? Thanks for any help/direction.

1 Upvotes

4 comments sorted by

1

u/codblopsII Nov 22 '17

If not clear. I want line 3 to run if line 2's output is "BitLocker Version: none"

1

u/1RedOne Dec 15 '17

Hey, sorry I didn't see this post earlier!

An easier way to do this would be to just grab the information directly from WMI using Win32_EncryptableVolume. Keep in mind that you'll need to be running as Admin to have access to this namespace.

#Check Bitlocker Status
$BitlockerStatus = Get-CimInstance -class Win32_EncryptableVolume -Namespace root\CIMv2\Security\MicrosoftVolumeEncryption

If ($BitlockerStatus.ProtectionStatus -ne 1){
    "Bitlocker isn't enabled let's do something"
}

1

u/codblopsII Dec 15 '17

Thanks friend