Another possibly strange remote registry issue

MPB

Mar 3, 2016
17
0
51
Thanks again for fixing the @regbread issue on remote reads so quick.

One other odd thing I found... I'm testing out using:
iff %@regexist[\\%comp%\HKLM\Software] EQ 0 then
sc \\%comp start remoteregistry > nul
endiff

Okay, pretty simple, try to read a key we know is there, and if it can't be read, assume the remote registry service isn't started (I preface that with a check to see if the machine is pingable).

I expected it to return a zero in a case where the winreg remote pipe wasn't responding, indicating that service is stopped. What I get instead is:
TCC: (Sys) No such host is known.
"\\<the computer name...>"

I just assumed it would return a "zero", same as if the machine were reachable but the key didn't exist. As it is, it throws an error in the iff/then and continues on to the "sc start" command. Which is fine in this case since that's what it would do in that situation anyway, but in a different case that could be the wrong next step. :)

What I was using in my old TCC v14 script was using "reg query" to do the same, and I can keep using that I guess, I thought I'd just try out some fancy JPSoft only tricks for the registry parts of my script...
reg query \\%comp%\HKLM\Software /ve >& nul
iff %? NE 0 then
sc \\%comp% start remoteregistry > nul
endiff

So I have a workaround, but thought I'd see if the @regexist for a remote machine that wasn't reachable through that remote winreg pipe was by design, or... ?

By the way, I used the now-working @regbread to read in some Groove sync client reg_binary key info and being able to parse that to get the local and URL info for what the client is syncing is WAY better looking than the ugly method I had been using, parsing the raw binary and converting to text, character by character. The @bpeekstr was especially useful, having the unicode option built in. Very cool.
 
May 20, 2008
11,437
99
Syracuse, NY, USA
Sometines this happens (after a 20 second delay).
Code:
v:\> echo %@regexist[\\qqqq\hklm]
TCC: (Sys) The operation completed successfully.
 "\\qqqq"
 

MPB

Mar 3, 2016
17
0
51
Here's another curious output... instead of just doing an "echo", try setting a variable to the output of the @regexist (it's important to make sure the remote computer actually exists/resolves, otherwise you'll get the "no such host" error which makes sense):
C:\> set x=%@regexist[\\actualcomputer\HKLM\Software] TCC: (Sys) The operation completed successfully. "\\actualcomputer" C:\> echo %x ECHO is OFF

By comparison, if the remote registry service is actually running on that remote machine, the "set" command works (no output) and "echo %x" returns 1.

The problem as I saw it was that I was trying to use it as a way of seeing if the remote registry service was actually running, by reading an arbitrary (but always present) key on the remote machine, and turns out that's not possible without parsing the text itself from the stderr output, looking for text that could very well change from version to version?

I don't really know what the answer is besides maybe returning a -1 for @regexist if the machine wasn't reachable (or not even resolvable. That might be safe enough so that people checking for "if %result% GT 0" to see if it succeeded are still getting what they want?

Not really complaining since I can do it with "reg query" and get the errorlevel from it which gives me what I need. Not sure if I'm missing any other really obvious ways of doing it?
 
Similar threads
Thread starter Title Forum Replies Date
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
vefatica Another popup problem Support 10
S How to? Runs start /w in invisible mode OR run program after exit of another one Support 3
G Press on another Window Support 24
vefatica Another problem with build 22. Support 3
Patulus Yet another thread on CMD compatibility Support 16
M Take Command 18, migrating to another machine, license problem. Support 1
MickeyF Another TPIPE question Support 6
vefatica Another installer thingy Support 1
vefatica Another @EVERYTHING question Support 4
C Touch command — I Need to touch matching files in another directory. Support 5
M Another "What is wrong?" Support 8
Bill de Haan Another installation is in progress Support 6
fishman@panix.com Another Problem with The Installer Support 1
Charles Dye Another modest proposal Support 4
Dan Glynhampton Documentation v15 help: Another mailto: link oddity Support 0
M WAD Another weird copy command errror... Support 2
M Yet another strange something re something called "@TCONVERT" Support 8
Charles Dye Documentation Another help nit Support 3
K_Meinhard Documentation Another installer nit Support 1
ehab aboudaya How to? change ALT-F6 to another key Support 1
A How to? Pass output from ffind to another command in a BTM file Support 5
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
Q TCC: (Sys) The process cannot access the file because it is being used by another process. Support 0
M Another bit of weirdness.... Support 0
S MOVE from FTP directory to another FTP directory - bug?? Support 2
vefatica Another debugger observation Support 12
vefatica Another DO /L question Support 1
M Another TCMD "crash" situation... Support 2
S Need help to execute TCC commands on another system Support 6
B TCC doesn't run using another user Support 2
H Another multiple FTP password prompt issue Support 2
Peter Bratton Another little bug? Support 1
M Another problem with renaming files... Support 3
nikbackm Another HISTORY dialog issue Support 0
vefatica Another help nit Support 12
S Another 4NT 8.02 vs TCC 9.02 diff - MOVE command Support 3
p.f.moore Running another batch file without CALL Support 7
L How to? Character transfer among @BALLOC buffers, command tails, and possibly redirected standard streams Support 11
M A possibly stupid question about the "del" command... Support 7
S WAD /Sn mishandled in DIR and PDIR, possibly elsewhere Support 15
R strange bug? Support 7
Jesse Heines Strange Line Wrapping Behavior Support 14
F strange results Support 9
M Strange error messages from TCC in FTP copy Support 7
forbin Strange handling of [nonbright] magenta background (v22) Support 2
N Fixed Strange dir behavior Support 6
vefatica REGDIR, strange error message Support 7
T WAD Strange Unexpected "features" in the Debugger Support 2
P Strange mouse behavior with list Support 2

Similar threads