Custom Fixlet

(imported topic written by edwinho91)

Hi, I’m Edwin and I’m new here.

I was doing some customization on how to set default printer.in command prompt which looks something like this :

c:\windows\system32\cscript prnmngr.vbs -t -p “account” where account is my default printer name. it work perfectly .

when i try to transfer it to fixlex , it keep on failing on attempt, then i read though the forum that i can use something like RunAsCurrentUser.exe which i have put into fixlet as such:

if {not exist file “run.exe” of system folder}

download http://192.168.0.14:52311/Uploads/run.exe

continue if { (size of it = 184320) of file “run.exe” of folder “__Download”}

move “{ (pathname of client folder of current site) & “__Download\run.exe”}” “{pathname of system folder}\run.exe”

endif

waithidden run.exe --w cmd.exe /C c:\WINDOWS\system32\cscript.exe prnmngr.vbs -t -p account

I have change the RunAsCurrentUser.exe into run.exe. But the same result still occur. Does anyone have any idea where did i went wrong ? Appreciate anyone who can give a helping hand.

thank You.

Edwin

(imported comment written by BenKus)

Hi edwin,

For troubleshooting, you might change your action from:

waithidden run.exe --w cmd.exe /C c:\WINDOWS\system32\cscript.exe prnmngr.vbs -t -p account

to

wait run.exe --w cmd.exe /K c:\WINDOWS\system32\cscript.exe prnmngr.vbs -t -p account

This should leave the cmd.exe window open on the computer and it will let you debug your command further… Also, you might try to verify that you action will indeed NOT work when run as the system account using the trick here: http://forum.bigfix.com/viewtopic.php?id=1098 so that you can verify that the user account is the problem.

Ben

(imported comment written by edwinho91)

Hi Ben,

Thanks for your reply, appreciate it really.

after a few round of testing , it’s still fail, so, i have changed my action script into this:

download http://support.bigfix.com/download/bes/util/RunAsCurrentUser.exe

continue if {(size of it = 131072 AND sha1 of it = “9fd47b14aee681a6bad6579d30d6fb3fa4cc3ae3”) of file “RunAsCurrentUser.exe” of folder “__Download”}

wait __Download/RunAsCurrentUser.exe --w {pathname of system folder}\cmd.exe /C {pathname of system folder}\cscript.exe {pathname of system folder}\prnmngr.vbs -t -p “account”

the surprise part is, it works !!! but the status reports back as “fail” even though it works. is there any way i can diagnose this ??

thanks again

P.S i did tried changing

wait __Download/RunAsCurrentUser.exe --w {pathname of system folder}\cmd.exe /C {pathname of system folder}\cscript.exe {pathname of system folder}\prnmngr.vbs -t -p “account”

into this:

wait __Download/RunAsCurrentUser.exe --w {pathname of system folder}\cmd.exe /K {pathname of system folder}\cscript.exe {pathname of system folder}\prnmngr.vbs -t -p “account”

and hope the screen will pop up for diagonse, but sadly it didn’t work. Really appreciate if you could give me some advice.

(imported comment written by BenKus)

Hi Edwinho,

If I understand you correctly, you have it working except for the fact that it reports “failed”? If so, instead of using a custom Fixlet, use a custom Task, which will report “Completed”.

Ben

(imported comment written by edwinho91)

Hi Ben,

Thanks for your help, i have manage to solve it.