need to output BitLocker status to txt file

I have a simple PowerShell script to check the status of BitLocker drive encryption on a computer on the network. I'd like for the script to determine the status of multiple computers in a text file.

Here's my basic script so far that Nathan Rice had helped with:

$TextFilePath = Read-Host "What is the path to the text file?"
If (Test-Path $TextFilePath) {
    $ComputersArray = Get-Content $TextFilePath
    ForEach ($Computer in $ComputersArray) {
        If (Test-Connection $Computer -Count 1) {
            $ComputerStatus = manage-bde -status -cn "$Computer"
            Write-Host($ComputerStatus)
        } Else {
            Write-Host("$Computer appears to be offline.")
        }
    }
} Else {
    Write-Error "The text file was not found, check the path."
}

I modified the code but it only writes one result to the text file, meaning if I have 5 computers in the list, it writes only the results for the first computer:

$TextFilePath = Read-Host "What is the path to the text file?"
If (Test-Path $TextFilePath){
    $ComputersArray = Get-Content $TextFilePath
    ForEach ($Computer in $ComputersArray) {
        If (Test-Connection $Computer -Count 1) {
            $ComputerStatus = manage-bde -status -cn "$Computer" |
               Out-File -filepath "c:\users\enduser\Bitlocker-Status.txt"
        } Else {
            Write-Host("$Computer appears to be offline.")
        }
    }
} Else {
    Write-Error "The text file was not found, check the path."
}

I'd like it to write the results for each device to the list.

Create a collection of results. After the loop, write the collection to a file.

$TextFilePath = Read-Host "What is the path to the text file?"
If (Test-Path $TextFilePath){
    $ComputersArray = Get-Content $TextFilePath
    $ComputerStatusCol = @()
ForEach ($Computer in $ComputersArray) {
        If (Test-Connection $Computer -Count 1){
            $ComputerStatus = manage-bde -status -cn "$Computer" 
            $ComputerStatusCol += $ComputerStatus
        } Else {
            Write-Host("$Computer appears to be offline.")
        }
    }
    $ComputerStatusCol | Out-File -filepath "c:\users\enduser\Bitlocker-Status.txt"
} Else {
    Write-Error "The text file was not found, check the path."
}

Checking of bitlocker & append results to text file, I will need to mass run the script to find which computers did not complete Here is the output of the status file when i run the above on it twice. Create a collection of results. After the loop, write the collection to a file.

You need to add the parameter -Append to the Out-File, so that your output is appended to the existing content instead of replacing it:

$ComputerStatus = manage-bde -status -cn "$Computer" |
    Out-File -filepath "c:\users\enduser\Bitlocker-Status.txt" -append -force

Bitlocker status in txt file - KiXtart.org, Shell "cmd.exe /c " + "manage-bde -status > c:\temp\encryption.txt" Sleep 5. Exit 0 You might need to catch stderr output. See redirect stderr. Read Bitlocker Encryption status of remote machine on the same domain, using a text file as computer name input 2. Write the information back into a CSV file specifically for c: only.

Easy batch file for admins who want a nice easy file to look through. Just set this up at one of my clients AD Networks, worked like a charm: Setup a .cdm file, dump it into the netlogon folder script: echo Computer:%ComputerName% with username:%username% - Bitlocker check of drive C: >> "\server\share\folder\BitlockerCheck.log"manage-bde -status c: >> "\server\share\folder\BitlockerCheck\BitlockerCheck.log"

Make sure everyone has access to share path (domain users)Edit Group Policy for the container you want it to run in (default domain policy should never be touched, if you want everyone, make a new policy at the top and name it Bitcloker status check). Go to User Configuration - Policies - Windows Settings - Scripts Right-click Logon, properties, Add - browse to \dcname\netlogon\filename.cmdclick OK, after about 15 minutes (without a forced gpupdate) the file will start populating as users logon/logoff.

On Non-BitLocker computers, it will show the computer name and user with no info.May be cumbersome on very large networks, but you could break out Gp script by OU and separate files as most large companies don't have everyone in one container.

Bitlocker status - PowerShell General - Ask the Experts, the problem that I am have now is the results for the bitlocker will only print on the screen, I would like for it to print to the txt file with the computer name. the� If I forgot to save my BitLocker recovery key when I enabled BitLocker on my laptop, how can I use Windows PowerShell to write it to a text file so I can copy it to a USB key for safe keeping? From an elevated Windows PowerShell console, use the Get-BitLockerVolume function, select -MountPoint C, choose the KeyProtector and the RecoveryPassword properties, and then redirect the output to a text file:

Bitlocker script check and one question - Learn PowerShell, At the end it removes the computer from the text file so it doesn't check the i need to check the status of all computers and need to get a output in a csv file� How can we manage it do get the bitlocker status (manage-bde -status c: > c:\temp\rtr.txt) in a file? I tried this with admin rights Shell "cmd.exe /c " + "manage-bde -status > c:\temp\encryption.txt" Sleep 5 Exit 0 but nothing in the encryption.txt file Ipconfig/all > txt file works fine

[SOLVED] Remote Bitlocker Status scan - CSV Output, Solution: Instead of parsing strings to get the output that you want, you can status of remote machine on the same domain, using a text file as� For example, to use wevtutil to export the contents of the Operational log from the BitLocker-API folder to a text file that is named BitLockerAPIOpsLog.txt, open a Command Prompt window, and run a command that resembles the following: wevtutil qe "Microsoft-Windows-BitLocker/BitLocker Operational" /f:text > BitLockerAPIOpsLog.txt

[SOLVED] Bitlocker status on all computers., Fields include LastLogonDate and the latest BitLocker password set date (if OUTPUTS CSV in script path . if you have either, then for each system (either in the AD or computers.txt), use Yes I have a list of computer in a csv file I can use . made some adjustment to the script. the problem that I am have now is the results for the bitlocker will only print on the screen, I would like for it to print to the txt file with the computer name. the computer name show up but the bitlocker results will not .

Comments
  • Actually, appending to an array in a loop should be avoided, because it tends to perform poorly. The operation doesn't really append to the existing array, instead it creates a new one with increased size, copies all existing values, puts the new item in the free slot at the end, then replaces the old array with the new one.