I have a fixlet created which calls a vbs which displays a message box to the user and asks for input then saves a text file to the local system. I am using the command runascurrentuser. The problem is it seems to work on only a number of them. What it does is displays the dialog box to run the action which we want, once the user hits take action it just runs and says finished without displaying the message box to user. So the job thinks its done but does not actually do anything for the logged on user.
I have multiple flavors of Windows OS: XP, Vista, Windows 7. But this is not consistent with one OS it happens across them all.
So I would like to know if anyone has seen this problem of the job not running correctly and why it works on some but not others.
I call the normal stuff for runascurrentuser but have this line calling the script which has been uploaded to the server.
For the computers that don’t display the message, do you see the wscript as a running process after you run the action?
I wonder if it is related to the user’s permissions of the folder where the vbs lives… Try copying the vbs it to somewhere else on the computer where all users have access…
I did see the process still running when I checked task manager but that was before I found RunAsCurrentUser which seemed to fix the problem for the time. I will check again on the next box I test with. But I don’t recall seeing it running after the job completed.
The script is being saved to the _Download location in the BesAgent folder under program files. Most of our users are not local admins so it restricts most of the C:\ drive. Thats when I found out saving it to the _download location did the trick since it was being run with root access.
I will try to test again to another location to see if that will do the trick. Maybe create a folder with them having access to it and just do a clean up after?!?!?
I edited the fixlet to create a folder on the root of the C: drive. I set the permissions for full control for Authenticated users. The job is doing the same thing as before, it asks to take action which the user does then it sits there for a few mins then goes away saying it has been completed.
I checked task manager and the job is not running hidden from the user. It seems to disappear after it thinks it’s done.
I’ve done something very similar (except with an HTA) and ran into a similar issue. Perhaps the same issue occurs with WScript. The solution for me was to create a vbscript that called the child script. Here’s the code
//Create a tiny VBScript that runs Form.hta and waits for it to exit. Interestingly, waithidden won’t do this for us (child process, perhaps?).
createfile until ENDOFFILE
Dim oShell
Set oShell = WScript.CreateObject(“WScript.Shell”)
oShell.Run “mshta.exe “”{value of variable “TEMP” of environment}\Form\Form.hta”"", 1, true
ENDOFFILE
copy __createfile “{value of variable “TEMP” of environment}\Form\Form.vbs”
//This is it! No turning back now!
waithidden __Download\RunAsCurrentUser.exe --w --q cscript.exe “{value of variable “TEMP” of environment}\Form\Form.vbs”
Note that you wouldn’t swap out mhta.exe with wscript.exe in the code above. I chose to store all the script files in a temporary location.