Force Docx File to auto open on users end

Hi everyone

Apologies this is my first post as i’m new to BigFix and new to scripting.

I run the following script in the Fix let Debugger and it works perfectly however, when i issue the same script in a BigFix Task it does not open the Word Doc on the users end (The document does get placed in the C:\Temp directory)

Please could someone help as i’m pulling my hair out :smile:

action uses wow64 redirection {not x64 of operating system}
wait {pathname of regapp “winword.exe”} "c:\Temp\Citrix Workspace Install Instructions.docx"
override run
hidden=true
runas=currentuser
run cmd /c “c:\Temp\Citrix Workspace Install Instructions.docx”

The first “wait” looks like it’s trying to open the docx but is still running in SYSTEM context, and won’t be visible to the user. Because it’s a ‘wait’ statement, it will open Word and hang the action until winword.exe is closed - but since the window isn’t visible to the user, this action is just going to pause until you kill winword.exe from the Task Manager.

The ‘overrides’ you’re using look mostly correct, except for the ‘hidden=true’. Run this way, it should try to open the doc under the user’s context - but without a visible window, since it’s still hidden. And since you’re using ‘run’ instead of ‘wait’, at least the action will be marked as completed and the client can move on to the next action while winword.exe is still open.

Try

override run
hidden=false
runas=currentuser
run cmd /c "c:\Temp\Citrix Workspace Install Instructions.docx"
1 Like

Thanks for the quick reply Jason.

As per your advice i have change the following, this continues to work in the Fixlet Debugger but not for the end user.
I can see the black CMD Screen briefly flash but does not open the Docx file.

action uses wow64 redirection {not x64 of operating system}
wait {pathname of regapp “winword.exe”} "c:\Temp\Citrix Workspace Install Instructions.docx"
override run
hidden=false
runas=currentuser
run cmd /c “c:\Temp\Citrix Workspace Install Instructions.docx”

Just to add, i also tried run instead of wait but still no joy.

Just as a test, try running with CMD /k instead of CMD /c. That will leave the command prompt window open so you can see if there is an error message.

I tired CMD /k and i just get a blank CMD Window (No Text)
Just to mention i do get a message when running in Fixlet Debugger “The action completed successfully, pending restart”

As a test i tried another script, which again works perfectly in the Debugger but not through the live server.
Could the above be related to any permissions on my BigFix Profile Account?

// *************************
// Message to user which pops up in notepad
// *************************

createfile until __EOF
!!!
!!! URGENT !!!
!!!

"Please Copy the following link to your Chrome Browser which will instruct you on how to remove Citrix Receiver (Now Unsupported) and update to the now supported version of Citrix Workspace"
https://docs.google.com/document/d/1fTNvqbwjnn6nde-kfu_KyNQJPTqc9-1P/edit

__EOF
delete C:\Temp\Citmessage.txt

move __createfile C:\Temp\Citmessage.txt

run cmd.exe /c C:\Temp\citmessage.txt

Not related to your Bigfix operator permissions.

Possibly related to whether SYSTEM knows how to process .docx or .txt files.

Definitely related to permission on the file you are trying to display to the user.

Definitely related to not having an override when trying to invoke something in the user context.

// *************************
// Message to user which pops up in notepad
// *************************

// parameter so I can move this easily
parameter "f"="{"C:\Temp\testfile.txt"}"

createfile until __EOF
!!!
!!! URGENT !!!
!!!

This is even more important!

__EOF
delete "{parameter "f"}"

move __createfile "{parameter "f"}"

// give the user permission to read the important file
override wait
hidden=true
wait icacls "{parameter "f"}" /grant users:r

// display the important file to the user
// explicit use of notepad
// using 'run' so that actions aren't stalled by a user not closing the instructions
override run
runas=currentuser
hidden=false
run "{pathname of file "notepad.exe" of windows folder}" "{parameter "f"}"

// wait a wee while, to be sure the file has been opened,  and tidy up
parameter "t"="{now + 5 * second}"
pause while {now < time(parameter "t")}

delete "{parameter "f"}"
2 Likes

Thank you, that worked a treat.

Could i ask, once the task has been accepted, is there is a way to show the notepad notification on top so the end user sees it straight away as currently i have to click on the notepad icon that hides in the taskbar to manually display it.

Thanks

// *************************
// Message to user which pops up in notepad
// *************************

// parameter so I can move this easily
parameter “f”="{“C:\Temp\testfile.txt”}"

createfile until __EOF
!!!
!!! URGENT !!!
!!!

This is even more important!

__EOF
delete “{parameter “f”}”

move __createfile “{parameter “f”}”

// give the user permission to read the important file
override wait
hidden=true
wait icacls “{parameter “f”}” /grant users:r

// display the important file to the user
// explicit use of notepad
// using ‘run’ so that actions aren’t stalled by a user not closing the instructions
override run
runas=currentuser
hidden=false
run “{pathname of file “notepad.exe” of windows folder}” “{parameter “f”}”

// wait a wee while, to be sure the file has been opened, and tidy up
parameter “t”="{now + 5 * second}"
pause while {now < time(parameter “t”)}

delete “{parameter “f”}”

In case it helps, the term to Google here is “Modal Dialog”. A Modal window pops to the front, and (optionally) can prevent switching to any other application.

Notepad itself does not have that functionality, but it could be done with a VBScript dialog box such as the tutorial at https://www.tutorialspoint.com/vbscript/vbscript_dialog_boxes.htm
There’s probably a PowerShell way too, if that’s your preference.

There is potential to annoy your users here - non-touch typists could enter significant amounts of text into your instruction document and not the document they thought they were using…

Thank you all again for your help. Great advice :slight_smile: