Deploy CMD is complaining the syntax is incorrect but the syntax IS correct
The following 3 lines I can run on cmd shell without issue, I do it all the time, which is why I wanted to PDQ it up.
C:\lgpo.exe /b C:\
FOR /F %i IN ('dir /b {*') DO set lgpodir=%i
C:\LGPO.exe /parse /m C:\%lgpodir%\DomainSysvol\GPO\Machine\registry.pol >> C:\lgpo.txt
But PDQ errors with:
LGPO.exe - Local Group Policy Object Utility
Version 3.0.2004.13001
Copyright (C) 2015-2020 Microsoft Corporation
Security Compliance Toolkit - https://www.microsoft.com/download/details.aspx?id=55319
Creating LGPO backup in "C:\{31379DC1-DF11-4271-A9DC-16612B190C43}"
The syntax of the command is incorrect.
And specifically I'm pretty sure its upset at this part:
FOR /F %i IN ('dir /b {*') DO set lgpodir=%i
I guess I can't tell it otherwise but how can I get my correct line here to execute from PDQ?
0
Comments
Just a bit more info - see how it works manually:
Deploy executes CMD steps as batch files, so you have to double up the %.
https://ss64.com/nt/for.html
OK thanks, it got past the
but the error is now on the next line. It seems that %lgpodir% isn't set.
I tried doing %%lgpodir%% but it just makes:
It seems that people do some fancy stuff with batch FOR but I don't see my case...besides why the heck can't it remember my lgopdir var??
Deploy does not start in C:\, so you probably need to add the following as the first line:
Much solve. Very brains
Please sign in to leave a comment.