Using Powershell with Cloverleaf, setting environment

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Using Powershell with Cloverleaf, setting environment

  • Creator
    Topic
  • #55749
    TorfinnK
    Participant

      Hello Clovertechers

      I’m in the unfortunate situation that some of my Cloverleaf installation runs on Windows

      Since .bat is very limited I’ve been looking into PowerShell

      My problem is to set the Cloverleaf environment variables in the begining of the script, setroot, setsite

      My workaround is to set the hciroot, hcisite in a .bat file, and from there call the PowerShell script.

      Does anyone have a more elegant solution?

    Viewing 2 reply threads
    • Author
      Replies
      • #86388
        Jay Clements
        Participant

          TorfinnK –

          I’ve run powershell scripts directly from TPS/TCL and it works excellently.

          I pass variables to the powershell from the TCL and then those variables influence how the powershell script behaves. I think its a very powerful combination, I can do just about anything I can dream of with that process.

          example (TCL):

          Code:

          exec powershell C:\cloverleaf\cis6.1\integrator\ghsadttest\usrcmds\SendVIPMail.ps1 -name $patientname -location $patientlocation

          I don’t see why you couldn’t use that tactic and “Invoke-Expression -Command $yourcommandshere” in powershell to achieve what you need. Sure it moves from context to context, but you could call that “microservice design” if you are really cheeky. 😆

          Perhaps I’m not entirely understanding the issue though, although if you are just looking for elegance, I feel like that excludes the majority of good, working, robust solutions for just about anything. But that’s all semantics.

          I think to truly answer your question there needs to be more information about what your end goal is.

          Thanks,

          Rob Clements

        • #86389
          Diana de Bruin
          Participant

            I’ve been looking at the same issue, but couldn’t figure out how to set the cloverleaf environment from a powershell script.

            I wanted to make a script that can restart a thread from within a powershell script.

            Diana

            LUMC -Leiden University Medical Centre
            The Netherlands

          • #86390
            TorfinnK
            Participant

              Hi

              It’s not really a problem when the script is called from Cloverleaf, then you have the Cloverleaf Environment.

              The problem is what also Diana describes, how to set the Cloverleaf Environment when you call the script from e.g. the Task Schedulere

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.