UNSOLVED Reg Query with 0.11.11 client

  • Server
    • FOG Version: 1.3.5
    • OS: Ubuntu
    • Service Version: 0.11.11
    • OS: Windows 10 pro 64 bits

    I run a script that write on a network share and use reg query.
    It was working fine on 1.3.4 but since i have updated to 1.3.5, some commands doesn’t look to work.
    I can write in local (such as c:) but not using \aComputerName\Myshare even using a “net use”.
    Reg query doesn’t return anything neither.

    These are the test I have done writing localy

    echo 1. blablabla >> C:\logs.txt
    REG QUERY %KEY_NAME% /v %VALUE_NAME% >> C:\logs.txt
    echo 3. %KEY_NAME% >> C:\logs.txt
    echo 4. %VALUE_NAME% >> C:\logs.txt
    echo 5. titi;toto;tata >> C:\logs.txt
    echo 6. %COMPUTERNAME%;%ValueValue% >> C:\logs.txt

    Here are the results :

    1. blablabla 
    3. HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate 
    4. SusClientId 
    5. titi;toto;tata 
    6. console; 

  • Hi,

    try this style:

    FOR /F "tokens=4 skip=3" %%i IN ('REG QUERY "HKLM\Software\Firma\Produkt" /ve') DO SET Pfad=%%i```

  • Tested using VBS.
    Result is the same and even

    objShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )

    return nothing.

  • I kind of make errors using “if defined ValueName ()” command.
    To confirm that “reg query” is the problem and that i don’t have problem of rights to create a directory, I have tested again with these two lines in my script.
    ( because I just realised that topic was a bit focusing on the wrong thing)

    if defined ValueName (echo %COMPUTERNAME%;%ValueValue% >> \\console\wsusclients$\logs.csv)
    echo %COMPUTERNAME%;%ValueValue% >> \\console\wsusclients$\logs.csv

    I have only one line in the logs.csv that is


    It means ValueName has no value.

  • @Joe-Schmitt That’s what I did. Hidden share with full rights for everybody.


  • Senior Developer

    @jmeyer said in Reg Query with 0.11.11 client:


    When using network shares with the FOG client you have to take extra steps. More than likely your share is restricted to AD bound computers. While technically the computer running the script may be bound to that domain, the client runs as SYSTEM, which is the local, unbounded, machine. Your best bet would be to create an anonymous read/write share, or mount the share using RunWithArgs and setting Hide.

  • Yes it is. Here is the orginal code :

    @echo OFF
    set KEY_NAME=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate
    set VALUE_NAME=SusClientId
    FOR /F "tokens=1-3" %%A IN ('REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul') DO (
        set ValueName=%%A
        set ValueType=%%B
        set ValueValue=%%C
    if defined ValueName (
    	echo %COMPUTERNAME%;%ValueValue% >> \\console\wsusclients$\logs.csv

  • Is this a command or a batch file?

  • ------------------------------------------------------------------------------
     20/03/2017 16:38 Client-Info Client Version: 0.11.11
     20/03/2017 16:38 Client-Info Client OS:      Windows
     20/03/2017 16:38 Client-Info Server Version: 1.3.5
     20/03/2017 16:38 Middleware::Response Success
     20/03/2017 16:38 SnapinClient Snapin Found:
     20/03/2017 16:38 SnapinClient     ID: 272
     20/03/2017 16:38 SnapinClient     Name: WSUS ID
     20/03/2017 16:38 SnapinClient     Created: 2017-03-20 15:38:00
     20/03/2017 16:38 SnapinClient     Action: 
     20/03/2017 16:38 SnapinClient     Pack: False
     20/03/2017 16:38 SnapinClient     Hide: False
     20/03/2017 16:38 SnapinClient     Server: 
     20/03/2017 16:38 SnapinClient     TimeOut: 0
     20/03/2017 16:38 SnapinClient     RunWith: cmd.exe
     20/03/2017 16:38 SnapinClient     RunWithArgs: /c
     20/03/2017 16:38 SnapinClient     Args: 
     20/03/2017 16:38 SnapinClient     File: SusClientId.cmd
     20/03/2017 16:38 Middleware::Communication Download: http://fogserver/fog/service/snapins.file.php?mac=4C:CC:6A:32:E5:4B||00:00:00:00:00:00:00:E0&taskid=272
     20/03/2017 16:38 SnapinClient C:\Program Files (x86)\FOG\tmp\SusClientId.cmd
     20/03/2017 16:38 Bus {
      "self": true,
      "channel": "Notification",
      "data": "{\r\n  \"title\": \"Installation de WSUS ID\",\r\n  \"message\": \"Ne pas éteindre l'ordinateur tant que la tâche n'est pas terminée\"\r\n}"
     20/03/2017 16:38 Bus Emmiting message on channel: Notification
     20/03/2017 16:38 SnapinClient Starting snapin...
     20/03/2017 16:38 SnapinClient Snapin finished
     20/03/2017 16:38 SnapinClient Return Code: 0
     20/03/2017 16:38 Bus {
      "self": true,
      "channel": "Notification",
      "data": "{\r\n  \"title\": \"WSUS ID installé\",\r\n  \"message\": \"L’installation est terminée, prêt pour l'utilisation\"\r\n}"
     20/03/2017 16:38 Bus Emmiting message on channel: Notification
     20/03/2017 16:38 Middleware::Communication URL: http://fogserver/fog/service/snapins.checkin.php?taskid=272&exitcode=0&mac=4C:CC:6A:32:E5:4B||00:00:00:00:00:00:00:E0&newService&json