Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Server 2019 Bug with @execstr?

Dec
10
0
Following up on our email thread from a few weeks ago ...

Receiving this error multiple times per day:
Unknown command "&"

I recently upgraded to TCC because TCCLE on Win2019 was throwing an access violation occasionally on the call to %@execstr[c:\windows\system32\inetsrv\appcmd ...]

Looks like this error that TCC is now throwing is on the same call. Is it possible that TCC is experiencing an internal error on Win2019 and it manifests slightly differently than the access violation in TCCLE? I'm only seeing this error on Win2019, same exact code runs fine on Win2008R2 and Win2012R2.

Best, Duane
 
It would probably be helpful to know the full and complete command that failed. And if it's a batch file, post the batch file itself.

Are you by any chance setting your command separator to something other than the ampersand?
 
I confess I don't understand the problem. Perhaps Rex will chip in.

But I would suggest replacing those multiline FOR loops with DO loops, just on general principles.
 
I believe we need the full command and error message, as there is no "&" in the BTM file.
 
I believe the "&" is implicitly added when commands inside parenthesis "( )" span multiple lines.

I had emailed Rex about this earlier. Ultimately here's the line that is causing the problem - if I comment this out it always works fine:

set access=%@execstr[c:\windows\system32\inetsrv\appcmd list config "www.mysite.com" -section:system.webServer/handlers -text:[path='*.gif'].requireAccess]

On Windows 2008R2 it would occasionally cause an access violation C0000005 on that same line. So I'm thinking that line is causing a similar problem on Window Server 2019 but just shows up with a different error message.
 
I realized the info above isn't quite correct. It was TCCLE on Windows Server 2019 that was throwing the access violation (not Win2008R2). So only Server 2019 is having issues, all other O/S's seem fine.
 
An @EXECSTR works by redirecting the output of the specified command to a temp file, and then reading the first line of that temp file.

So there's two possible things that could be going wrong here:

1) The command passed to @EXECSTR has a formatting problem (with an extra or bad "&" inserted).
2) The result of the @EXECSTR is a "&" on the first line, and it's actually SET that's complaining.

You can test the first possibility by adding a logging statement before the @execstr call that echos (to a file) the argument list passed to appcmd.exe

You can test the second possibility by enclosing the %@execstr[...] statement in double quotes, so it will be assigned to SET as a literal &.
 
Hi Rex, thanks for the info. I just added that to the script and ran it.

For #1 above here's what it shows as the actual arguments to appcmd - there are square brackes, not sure if that matters.
list config "www.compellingtruth.org" -section:system.webServer\/handlers -text:[path='*.gif'].requireAccess

For #2 above I've echo'ed out the full results of the command, it is always just 1 line, looks like this:
ERROR ( message:Cannot find requested collection element. )

Not sure if it matters there are parenthesis in the results that command. If I put quotes around the whole @exestr command like this:
set access="%@execstr[appcmd list config "%sitename%" -section:system.webServer/handlers -text:[path='*.%ext%'].requireAccess]"

it appears the assigned variable will have the quotes too, so don't think I want to do that. I did some testing on the TCC command line and that's what I saw with the "set" command.

So no smoking guns that I can tell, unless like I mentioned above it doesn't like square brackets in the argument or parenthesis in the return variable. But seems unlikely, the problem occurs about 10% of the time whereas those arguments are like above 100% of the time.
 
If you add IIS (Internet Information Services) to your VM you should get the appcmd executable. Then call this a couple hundred times:

set myvar=%@execstr[c:\windows\system32\inetsrv\appcmd list config "www.mysite.com" -section:system.webServer/handlers -text:[path='*.gif'].requireAccess]

The "www.mysite.com" can be altered to the name of any site you add to IIS, or just the name of the default site, "Default Site"
 
Back
Top
[FOX] Ultimate Translator
Translate