Query Registry for the REG-SZ Data
We added a new license server and I need to ensure everyone is pointing to it so I would like to return the Data of a REG_SZ Named "Server Order" in the registry.
The Name Server Order, Type is REG_SZ and Data will be the server name i.e.: LicSVR1
I tried the following and can't seem to get the syntax right
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\wer\Licensing\"Server Order"="LicSVR1""
It doesn't find it, I tried a few different switches, the /t is supposed to find the REG_SZ data but I can't get it to work
Thanks in advance for the help
The Name Server Order, Type is REG_SZ and Data will be the server name i.e.: LicSVR1
I tried the following and can't seem to get the syntax right
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\wer\Licensing\"Server Order"="LicSVR1""
It doesn't find it, I tried a few different switches, the /t is supposed to find the REG_SZ data but I can't get it to work
Thanks in advance for the help
2 Comments
[ + ] Show comments
Answers (3)
Answer Summary:
Please log in to answer
Posted by:
SMal.tmcc
8 years ago
Posted by:
SMal.tmcc
8 years ago
you need to do something like this in a batch to run this or that based on the key
reg query "HKLM\SOFTWARE\Wow6432Node\wer\Licensing /v "Server Order" /f LicSVR1 /d
if %ERRORLEVEL% EQU 0 goto :equal
Rem change this to the not equal stuff you want to do
:not equal
echo not equal
pause
end
Rem change this to the equal stuff you want to do
:equal
echo equal
pause
end
Posted by:
Newbie0000
8 years ago
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\wer\Licensing\" /v "Server Order"
And it returned
Server Order REG_SZ LicSVR1
But now I have to get the correct syntax in the script to search and if it finds the LicSVR1 the script continues if not it installs the correct one. I have all the script working except for when it look to see what the server is??
Thanks again. - Newbie0000 8 years ago
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\wer\Licensing\" /v "Server Order" (This is where I have tried = "LicSVR1" and others to say if you see LicSVR1 add to flag file if not install is from ....)
if %errorlevel% EQU 0 (
echo %date% %computername% LicSVR1 Installed >> "C:\Windows\System32\flags\wer.txt"
)
if %errorlevel% NEQ 0 (
"\\networkshare\install.cmd"
echo %date% %computername% LicSVR1 Re-Installed >> "C:\Windows\System32\flags\wer.txt"
goto :eof
) - Newbie0000 8 years ago