Mkdir not working if deployed from TEM Server

(imported topic written by Braian)

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”

(imported comment written by NoahSalzman)

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.

(imported comment written by Braian)

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

(imported comment written by martinc)

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

(imported comment written by Braian)

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

(imported comment written by martinc)

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)

(imported comment written by liuhoting)

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?