It's driving me nuts.
Here's my simple batch command to pull the recovery keys from some local machines.
net use y: /USER:***** \\server\recoverykeys PASSWORD wmic /output:c:\wmic.txt bios get serialnumber /format:csv type c:\wmic.txt > c:\sn.txt for /F "skip=2 delims=, tokens=2" %%a IN (c:\sn.txt) DO set sn=%%a del c:\wmic.txt c:\sn.txt manage-bde -protectors -get c: > y:\recoverykeys\%computername%_%sn%.txt net use y: /delete /y
The line that has problems is line 6. Everything else is working. What happens is a blank file is being created on my server share. The output of the command isn't working.
So to test, I replaced line 6 with:
echo "hello this works" > y:\recoverykeys\%computername%_%sn%.txt
The file is created with the content "hello this works".
I am totally dumbfounded why the command "Manage-bde -protectors -get c:" is failing to output anything.
If I run this batch file as administrator on the local machine, it works successfully. If run as a distribution package, it creates an empty file. I've even total the package to be run as local administrator to test, instead of Local System, and it still fails.
I'm tired, what am I missing here?