hexagon logo

Script Demand - goal is open pdf with different user

Hello all,

I am trying to have a pdf open using a different user. I have managed to do so using a bat file containing a runas command executed with a an external commande but the thing is that I have a cmd popup that I would like to avoid. By creating a .vbs file that runs this bat file, I am able to open the pdf without the cmd popup but pcdmis seems to be unable to run this .vbs file. Is it possible thorugh basic scripting to open that bat file or the pdf directly using another user? Maybe start a task scheduled on demand?

Thanks in advance for your ideas!
Parents
  • Good Day,

    This seems to be working in 2021.2


    Basic Script:
    Sub Main
    Shell "wscript C:\Users\QS\Desktop\test.vbs", vbNormalFocus
    End Sub
    



    ​pcDMIS Call the basic Script:
    CS2 =SCRIPT/FILENAME= C:\USERS\QS\DESKTOP\TEST.BAS
    FUNCTION/Main,SHOW=YES,,
    STARTSCRIPT/
    ENDSCRIPT/​
    


    the *.vbs script i used (shows ComputerName​)
    dim Network
    set Network = CreateObject("WScript.Network")
    MsgBox "" & Network.UserName
    MsgBox "" & Network.ComputerName​
    


    Thanks for the code! Can you make it run as another user (not the windows user already logged on)
  • no, this is always executed as the user under which pcDMIS is running, if you start it from pcDMIS
    you have to handle it as a RunAs command, thought that could be done with vbs and therefore you only needed the .vbs call?
Reply Children
No Data