Snapin error codes



  • I created a snapin that runs a .bat file. If I run the .bat file locally on my computer (not using FOG), it runs fine. Using a FOG Snapin, it looks like it runs, even says successful, but no program is installed.

    What is a return code 4?

    ------------------------------------------------------------------------------
    ---------------------------------SnapinClient---------------------------------
    ------------------------------------------------------------------------------
     6/1/2016 11:00 AM Client-Info Client Version: 0.10.6
     6/1/2016 11:00 AM Client-Info Client OS:      Windows
     6/1/2016 11:00 AM Client-Info Server Version: 7717
     6/1/2016 11:00 AM Middleware::Response Success
     6/1/2016 11:00 AM SnapinClient Snapin Found:
     6/1/2016 11:00 AM SnapinClient     ID: 37
     6/1/2016 11:00 AM SnapinClient     RunWith: cmd.exe
     6/1/2016 11:00 AM SnapinClient     RunWithArgs: /c
     6/1/2016 11:00 AM SnapinClient     Name: Beyond Question
     6/1/2016 11:00 AM SnapinClient     File: BeyondQuestion.bat
     6/1/2016 11:00 AM SnapinClient     Created: 2016-06-01 10:56:52
     6/1/2016 11:00 AM SnapinClient     Args: 
     6/1/2016 11:00 AM SnapinClient     Action: 
     6/1/2016 11:00 AM Middleware::Communication Download: http://fog-server/fog/service/snapins.file.php?mac=F0:1F:AF:29:BF:C2|0C:84:DC:8E:2B:ED|0C:84:DC:8E:2B:ED|0A:00:27:00:00:0E||00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0&taskid=37
     6/1/2016 11:00 AM SnapinClient C:\Program Files (x86)\FOG\tmp\BeyondQuestion.bat
     6/1/2016 11:00 AM Bus {
      "self": true,
      "channel": "Notification",
      "data": "{\r\n  \"title\": \"Installing Beyond Question\",\r\n  \"message\": \"Please do not shutdown until this is completed\",\r\n  \"subjectID\": \"snapin-Beyond Question\"\r\n}"
    }
     6/1/2016 11:00 AM Bus Emmiting message on channel: Notification
     6/1/2016 11:00 AM SnapinClient Starting snapin...
     6/1/2016 11:00 AM SnapinClient Snapin finished
     6/1/2016 11:00 AM SnapinClient Return Code: 4
     6/1/2016 11:00 AM Bus {
      "self": true,
      "channel": "Notification",
      "data": "{\r\n  \"title\": \"Beyond Question Installed\",\r\n  \"message\": \"Installation has finished and is now ready for use\",\r\n  \"subjectID\": \"snapin-Beyond Question\"\r\n}"
    }
     6/1/2016 11:00 AM Bus Emmiting message on channel: Notification
     6/1/2016 11:00 AM Middleware::Communication URL: http://fog-server/fog/service/snapins.checkin.php?taskid=37&exitcode=4&mac=F0:1F:AF:29:BF:C2|0C:84:DC:8E:2B:ED|0C:84:DC:8E:2B:ED|0A:00:27:00:00:0E||00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0|00:00:00:00:00:00:00:E0&newService&json
    ------------------------------------------------------------------------------
    

  • Moderator

    @Tom-Elliott TIL xcopy has internal error codes, that’s very useful.


  • Senior Developer

    http://stackoverflow.com/questions/8219040/windows-copy-command-return-codes

    It’s apparently the error code of a portion of the batch, not the batch itself.


  • Senior Developer

    @Scott-Adams The error codes you see are as they come from the installing program. If it’s from a batch file, it’s likely a batch file error code.


  • Moderator

    @Scott-Adams

    xcopy /e “\\x.x.x.x\WES_Apps\Technology\Beyond Question\Beyond Question” “C:\%programpath%\Beyond Question”

    should be

    xcopy /e "\\x.x.x.x\WES_Apps\Technology\Beyond Question\Beyond Question" "%programpath%\Beyond Question"

    Since %programpath% will include the drive letter already as inherited from %programfiles(x86)%

    Please test the batch file manually to confirm.

    #Edited to add backticks so we can properly see the command.


  • Moderator

    @Scott-Adams the xcopy command is using the locally logged in user when you run it manually, and is using SYSTEM when snapins run it. You have to specify credentials, or set the share to read-only for “everyone”.



  • @Wayne-Workman

    set programpath=%programfiles(x86)%
    IF %PROCESSOR_ARCHITECTURE%==x86 set programpath=%programfiles%
    IF EXIST "%programpath%\Beyond Question" GOTO END
    xcopy /e "\\x.x.x.x\WES_Apps\Technology\Beyond Question\Beyond Question" "C:\%programpath%\Beyond Question"
    :END
    

    #Edited to show the double slashes by placing in code ticks.


  • Moderator

    I believe the error codes are general windows error codes (correct me if I’m wrong)

    In which case it’s

    ERROR_TOO_MANY_OPEN_FILES
    4 (0x4)
    The system cannot open the file.
    

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    Which of course isn’t particularly helpful on its own.


  • Moderator

    Can we get a copy of the .bat file? Remove IPs and replace with x.x.x.x and remove usernames and replace with UserNameGoesHere and passwords with PasswordGoesHere


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.