Page 1 of 1 1
Topic Options
#211136 - 2016-02-23 09:42 PM Bitlocker status in txt file
Patrick99 Offline
Fresh Scripter

Registered: 2016-02-19
Posts: 14
Loc: Belgium
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...

Top
#211137 - 2016-02-23 11:37 PM Re: Bitlocker status in txt file [Re: Patrick99]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
A. Why the sleep? Seems unnecessary as Shell will wait for the command to complete.
B. Try the WSHPipe UDF - it will capture both STDOUT and STDERR. Your command only writes STDOUT. Just write the output to the screen to see what you get..
C. Does the command (with the redirection) work when you run it from the command line?

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#211138 - 2016-02-24 01:24 AM Re: Bitlocker status in txt file [Re: Glenn Barnas]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2082
Loc: Tulsa, OK
It is odd. I am getting the same results. I get text when run from command line, but nothing when i run the same thing from kix.

CMD line:
 Code:
manage-bde -status > c:\users\shane\desktop\testbde.txt
results in a txt file containing
 Quote:
BitLocker Drive Encryption: Configuration Tool version 10.0.10011
Copyright (C) 2013 Microsoft Corporation. All rights reserved.

ERROR: An attempt to access a required resource was denied.

Check that you have administrative rights on the computer.
where as the following Kix:
 Code:
Shell "%comspec% /c manage-bde -status > c:\users\shane\desktop\testbde.txt"
results in an empty text file.

Top
#211139 - 2016-02-24 03:24 AM Re: Bitlocker status in txt file [Re: ShaneEP]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4482
Loc: USA
Mark my words... its the damn uac getting in the way.
Top
#211140 - 2016-02-24 12:11 PM Re: Bitlocker status in txt file [Re: Allen]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 680
Loc: Maryland, USA
You might need to catch stderr output. See redirect stderr
Top
#211141 - 2016-02-24 03:11 PM Re: Bitlocker status in txt file [Re: BradV]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
When I run this from Kix, STDERR reports
 Code:
'C:\Windows\System32\manage-bde.exe' is not recognized as an internal or external command, operable program or batch file.
The error is not reported when run directly from the command line.

One thing to consider - Kix is a 32-bit app, and the Shell command calls the 32-bit shell environment via SYSWOW File Redirection. It's possible that the command won't run there. I've encountered this before and I recall there's a workaround.. I'll need to go dig into the code that I wrote.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#211142 - 2016-02-24 03:21 PM Re: Bitlocker status in txt file [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
OK - just tested this and it's damned simple!
 Code:
; save the original setting and turn x64 File Redirection off
$WFR = SetOption('WOW64FileRedirection', 'off')
;
; run your 64-bit commands
;
; restore the original setting
$WFR = SetOption('WOW64FileRedirection', $WFR)
Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#211143 - 2016-02-24 07:29 PM Re: Bitlocker status in txt file [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11577
Loc: CA
Simple when you know the available commands :-)
Top
#211144 - 2016-02-24 07:59 PM Re: Bitlocker status in txt file [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
Yeah, but the real issue became apparent when you saw the STDERR messages, which Brad and I referenced earlier.

It's something we need to be more cognizant of, with many of the current command-line tools working fine at the command line but not when called from scripts.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#211145 - 2016-02-25 01:50 AM Re: Bitlocker status in txt file [Re: Glenn Barnas]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2082
Loc: Tulsa, OK
Sadly, the thought of it being a 32/64 bit issue never crossed my mind. But it indeed resolved the issue.
Top
#211146 - 2016-02-25 12:46 PM Re: Bitlocker status in txt file [Re: ShaneEP]
Patrick99 Offline
Fresh Scripter

Registered: 2016-02-19
Posts: 14
Loc: Belgium
yes, indeed all solved... Thanks!
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 158 anonymous users online.
Newest Members
Jodey, Hiker, GTRoberts, KatieQuinn, Brennnnn
17684 Registered Users

Generated in 0.036 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org