|
|
|||||||
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... |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 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. Code: Shell "%comspec% /c manage-bde -status > c:\users\shane\desktop\testbde.txt" |
||||||||
|
|
|||||||
Mark my words... its the damn uac getting in the way. |
||||||||
|
|
|||||||
You might need to catch stderr output. See redirect stderr |
||||||||
|
|
|||||||
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. 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 |
||||||||
|
|
|||||||
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) |
||||||||
|
|
|||||||
Simple when you know the available commands :-) |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Sadly, the thought of it being a 32/64 bit issue never crossed my mind. But it indeed resolved the issue. |
||||||||
|
|
|||||||
yes, indeed all solved... Thanks! |