-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGet-EncryptionStatus.ps1
32 lines (31 loc) · 1.24 KB
/
Get-EncryptionStatus.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function Get-EncryptionStatus ($InputFile)
#Returns the Encryption Status of the computers listed in the input file
#Input file is a list of hostnames, one per line
#Usage Example
# Get-EncryptionStatus("C:\users\me\desktop\HostnameList.txt")
{
#Read in the contents of the file
$hostnames=get-content $InputFile
#Loop through the list of hostnames one at a time
ForEach ($hostname in $hostnames)
{
#Check the Encryption Status of the C: drive, filter to the Conversion Status line
$EncryptionStatus=(manage-bde -status -computername "$hostname" C: | where {$_ -match 'Conversion Status'})
#Check a status was returned.
if ($EncryptionStatus)
{
#Status was returned, tidy up the formatting
$EncryptionStatus=$EncryptionStatus.Split(":")[1].trim()
}
else
{
#Status was not returned. Explain why in the output
$EncryptionStatus="Not Found On Network (or access denied)"
}
#Format the output object. 2 fields "Hostname" and "Status"
[pscustomobject][ordered]@{
'Hostname'=$Hostname;
'Status'=$EncryptionStatus;
}
}#End of Loop through Hostnames
}#End of Function