Batch file to Output

BatchPatch Forums Home Forums BatchPatch Support Forum Batch file to Output

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8859
    Phil
    Participant

    I have setup a small batch file with output to the console to check and see if a couple functions of the OS are enabled. I would like to use batchpatch to remotely deploy this batch file and record the output to a log on the local workstation I’m running this from.

    I used the Deploy Software/patch/script/regkey etc and it ran the batch file with no issues. I then check the box to retrieve the console output and it will no longer work and there is no output.

    Is there more I need to do?

    #10185
    doug
    Moderator

    That checkbox is not compatible with all scripts, hence the note below the checkbox that explains it ‘may cause a deployment to fail/error in some cases.’ If you share your script, I might be able to help get it to work.

    -Doug

    #10186
    Phil
    Participant

    @echo off

    REM Run Command to see if bitlocker is On

    SETLOCAL ENABLEDELAYEDEXPANSION

    SET count=1

    FOR /F “tokens=* USEBACKQ” %%F IN (manage-bde -status c:) DO (

    SET var!count!=%%F

    SET /a count=!count!+1

    )

    REM %var7% contains status

    REM If statment to see if it is enabled

    echo.%var7%|findstr /C:”Fully Encrypted” >nul 2>&1

    if not errorlevel 1 (

    REM The drive is already fully Encrypted

    ECHO The drive is already fully Encrypted

    CALL :TurnOnProtection

    ) else (

    REM The drive is not Fully Encrypted

    ECHO The drive is not Fully Encrypted

    CALL :SetOwner

    )

    GOTO :EOF

    :SetOwner

    REM This will set the owner of Bit Locker

    ECHO Set Owner

    SET count=1

    FOR /F “tokens=* USEBACKQ” %%F IN (manage-bde -tpm -takeownership XXXXX) DO (

    SET var!count!=%%F

    SET /a count=!count!+1

    )

    CALL :TurnOnProtection

    :TurnOnProtection

    REM This will turn on Bit Locker

    ECHO Add C To Bit Locker

    SET count=1

    FOR /F “tokens=* USEBACKQ” %%F IN (manage-bde -protectors -add -rp c:) DO (

    SET var!count!=%%F

    SET /a count=!count!+1

    )

    ECHO Turn On Bit Locker

    SET count=1

    FOR /F “tokens=* USEBACKQ” %%F IN (manage-bde -on c:) DO (

    SET var!count!=%%F

    SET /a count=!count!+1

    )

    exit /b 0

    :EOF

    ENDLOCAL

    exit /b 1

    #10177
    Phil
    Participant

    Hi Doug,

    Here’s the script I’m working with. Let me know what you think.

    Thanks,

    Phil

    #10178
    doug
    Moderator

    Thanks, Phil. Unfortunately I don’t think we’ll be able to make this compatible with the ‘retrieve console output’ option in this version of BP. Realistically it probably needs to be re-written in powershell or vbscript or similar to get it working right now. However, Scott thinks he just figured out why it’s not working as-is with the current code, so I think we probably ought to be able to get this working in the next version of BP.

    -Doug

    #10179
    Phil
    Participant

    Thanks for taking a look. I will see what I can do with PS.

    #10180
    doug
    Moderator

    No problem. Also FYI Scott did get it working after altering/updating some of our code, so the fix will be included in the next release.

    -Doug

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.