Topic
  • 6 replies
  • Latest Post - ‏2013-10-03T00:59:05Z by liuhoting
Braian
Braian
61 Posts

Pinned topic mkdir not working if deployed from TEM Server

‏2013-09-30T07:39:02Z |

HI All,

I'm trying to create a folder through TEM server buy deploying a fixlet with a action script: dos mkdir "c:\folder". The action completed without error but will not create the folder. when i try the script locally it works. I also tried deploying using runascurrentuser, but not successful too. The script below is also not working if run locally from cmd.

Script:

prefetch RunAsCurrentUser.exe sha1:ee47505ebfb2790b9da8a20ed70e67158e9753d0 size:342528 http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

Waithidden __download\RunAsCurrentUser.exe --w cmd.exe /C mkdir "c:\mse"

  • NoahSalzman
    NoahSalzman
    676 Posts

    Re: mkdir not working if deployed from TEM Server

    ‏2013-09-30T16:15:16Z  

    That syntax worked for me when executed in a test fixlet from the Console. It did not work from the Fixlet Debugger which, I believe, is a known limitation of the debugger.

    Note that the current user in that case was an Administrator... so take note of which user is the current user.

  • martinc
    martinc
    47 Posts

    Re: mkdir not working if deployed from TEM Server

    ‏2013-09-30T18:40:52Z  

    I am thinking the runascurrentuser command could be a permissions issue. Make sure you are logged on as someone that has the rights to create. Maybe manually try to create a folder on the root of C:

    The "dos mkdir" part should work and it should be running as the system account, so there should be no issue with permissions. I tested this with a custom action using the following commands:

    wait cmd.exe /c mkdir "c:\blahblah_cmd"
    dos mkdir "c:\blahblah_dos"

    And these both worked fine.

    Did  you look at the agent log file? 

    Martin

  • Braian
    Braian
    61 Posts

    Re: mkdir not working if deployed from TEM Server

    ‏2013-10-01T03:24:29Z  

    That syntax worked for me when executed in a test fixlet from the Console. It did not work from the Fixlet Debugger which, I believe, is a known limitation of the debugger.

    Note that the current user in that case was an Administrator... so take note of which user is the current user.

    Hi Noah,

     

    Thanks for the reply. It's not working for both console or fixlet debugger, but if i run the dos mkdir "c:\blahblah" its working fine, but if i deployed it through console with or without runascurrent user is not working for me. the OS is Win7 32/64.

     

    Thanks,

    Braian

  • Braian
    Braian
    61 Posts

    Re: mkdir not working if deployed from TEM Server

    ‏2013-10-01T03:27:29Z  
    • martinc
    • ‏2013-09-30T18:40:52Z

    I am thinking the runascurrentuser command could be a permissions issue. Make sure you are logged on as someone that has the rights to create. Maybe manually try to create a folder on the root of C:

    The "dos mkdir" part should work and it should be running as the system account, so there should be no issue with permissions. I tested this with a custom action using the following commands:

    wait cmd.exe /c mkdir "c:\blahblah_cmd"
    dos mkdir "c:\blahblah_dos"

    And these both worked fine.

    Did  you look at the agent log file? 

    Martin

    Hi Martin,

    Thanks for the reply.

    wait cmd.exe /c mkdir "c:\blahblah_cmd" and dos mkdir "c:\blahblah_dos" is working if you run through debugger but not if deployed through console. Thats why i tried runascurrentuser but not successful either.

     

    Thanks,

    Braian

     

  • martinc
    martinc
    47 Posts

    Re: mkdir not working if deployed from TEM Server

    ‏2013-10-01T03:49:44Z  
    • Braian
    • ‏2013-10-01T03:27:29Z

    Hi Martin,

    Thanks for the reply.

    wait cmd.exe /c mkdir "c:\blahblah_cmd" and dos mkdir "c:\blahblah_dos" is working if you run through debugger but not if deployed through console. Thats why i tried runascurrentuser but not successful either.

     

    Thanks,

    Braian

     

    ok, couple things

    1. Check to see that the service is running as System

    2. put the command "mkdir c:\blahblah" into a batch file and use the windows scheduler to run it. Since this is running as system, it should be behaving the same as the TEM agent.

    Also check your BES Client log file and see what it says when you run it through the client.

     

    For example, my log showed the following

    At 12:39:21 -0600 - actionsite (http://winbfsrv.gulfsoft.local:52311/cgi-bin/bfgather.exe/actionsite)
       Command started - wait cmd.exe /c mkdir "c:\blahblah_cmd" (action:746)
    At 12:39:22 -0600 - 
       Report posted successfully
    At 12:39:22 -0600 - actionsite (http://winbfsrv.gulfsoft.local:52311/cgi-bin/bfgather.exe/actionsite)
       Command succeeded (Exit Code=0) wait cmd.exe /c mkdir "c:\blahblah_cmd" (action:746)
       Command started - dos mkdir "c:\blahblah_dos" (action:746)
       Command succeeded dos mkdir "c:\blahblah_dos" (action:746)
     

     

  • liuhoting
    liuhoting
    32 Posts

    Re: mkdir not working if deployed from TEM Server

    ‏2013-10-03T00:59:05Z  
    • martinc
    • ‏2013-10-01T03:49:44Z

    ok, couple things

    1. Check to see that the service is running as System

    2. put the command "mkdir c:\blahblah" into a batch file and use the windows scheduler to run it. Since this is running as system, it should be behaving the same as the TEM agent.

    Also check your BES Client log file and see what it says when you run it through the client.

     

    For example, my log showed the following

    At 12:39:21 -0600 - actionsite (http://winbfsrv.gulfsoft.local:52311/cgi-bin/bfgather.exe/actionsite)
       Command started - wait cmd.exe /c mkdir "c:\blahblah_cmd" (action:746)
    At 12:39:22 -0600 - 
       Report posted successfully
    At 12:39:22 -0600 - actionsite (http://winbfsrv.gulfsoft.local:52311/cgi-bin/bfgather.exe/actionsite)
       Command succeeded (Exit Code=0) wait cmd.exe /c mkdir "c:\blahblah_cmd" (action:746)
       Command started - dos mkdir "c:\blahblah_dos" (action:746)
       Command succeeded dos mkdir "c:\blahblah_dos" (action:746)
     

     

    In a lot of our scripts we don't tend to go with the cmd.exe /c route. We tend to throw everything in a .bat file and then execute that. Have you tried giving that a go?