Solved

WMI Query for BitLocker status on C drive in Task Sequence in SCCM

Posted on 2013-06-24
2
3,251 Views
Last Modified: 2013-07-02
I need to put a bit of logic in my task sequence that will only deploy a package if the C drive is not encrypted (there are two volumes on our machines)

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2\Security\MicrosoftVolumeEncryption") 
' Obtain an instance of the the class 
' using a key property value.
Set objShare = objWMIService.Get("Win32_EncryptableVolume.DeviceID='\\?\Volume{1e2a7781-dd0f-11e2-90bf-24be05232bd4}\'")

' no InParameters to define

' Execute the method and obtain the return status.
' The OutParameters object in objOutParams
' is created by the provider.
Set objOutParams = objWMIService.ExecMethod("Win32_EncryptableVolume.DeviceID='\\?\Volume{1e2a7781-dd0f-11e2-90bf-24be05232bd4}\'", "GetLockStatus")

' List OutParams
Wscript.Echo "Out Parameters: "
Wscript.echo "LockStatus: " & objOutParams.LockStatus
Wscript.echo "ReturnValue: " & objOutParams.ReturnValue

Open in new window


How do I get to the point of identifying the C drive as the volumes are shown as security identifiers?

Can anyone assist?
0
Comment
Question by:aideb
2 Comments
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 39273843
Powershell
$BitLockDrive = get-wmiobject -ComputerName "." -namespace root\CIMv2\Security\MicrosoftVolumeEncryption `
        -class Win32_EncryptableVolume `
        | select DriveLetter, IsVolumeInitializedforProtection
foreach( $drive in $BitLockDrive) {
#$Write-Output ($drive.DriveLetter)
If (($drive.DriveLetter -eq "C:" ) -and ($drive.IsVolumeInitializedforProtection -like "False") )
    {
   # This Drive is Not Encrypted
    $drive.DriveLetter
    $drive.IsVolumeInitializedForProtection
    }
}
     

Open in new window

0
 
LVL 2

Author Closing Comment

by:aideb
ID: 39294777
Thanks for a great solution!
0

Featured Post

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip is around source server preparation. No migration is an easy migration, there is a…
Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found listed in my profile here: http:…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now