Menu

get error while running staf with powershell cmdlets imported from custom application

2014-09-19
2014-09-23
  • Sharon Lucas

    Sharon Lucas - 2014-09-19

    When you submit a STAF PROCESS START request to run a command, the command will be run in the environment that STAFProc is running in, not in the environment of the command prompt from which you submitted the STAF PROCESS START request. So, my guess is that there is an environment variable set in the environment of your command prompt that allows powershell to find the Get-DpExcConfig dll file (as you are getting error "FullyQualifiedErrorId : Get-DpExcConfig" which appears to indicate that powershell cannot find this file). You said you updated the PsModulePath variable with the path to dll file. Is this an environment variable that allows powershell to find the path to the Get-DpExcConfig file? If so, then you either need update this environment variable in the environment in which STAFProc is running (e.g. set it and then restart STAFProc in this environment), or you can use the ENV option on a PROCESS START request to set an environment variable. See section "8.13 Process Service" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRPROCSRV for more information about the ENV option on a PROCESS START request.

    Also, I'm not a PowerShell user, but the command that you said works at the command line without using STAF does not appear to be the same command that you're trying to run via a STAF PROCESS START request as the command you ran via a command prompt started with "& {ipmo".

     
  • Nicolae Radulet

    Nicolae Radulet - 2014-09-23

    Hi Sharon,

    Sorry for late response but I was working to find a better solution and I think I found it. This is the command that I've used:

    C:\STAF>staf local process start shell "powershell -c %c" command ""Invoke-Command -computername localhost {ipmo C:\Program` Files\Tivoli\Flashcopymanager\FmMod
    uleExc.dll;Get-DpExcConfig}"" workdir "C:\Program Files\Tivoli\FlashcopyManager" wait returnstderr returnstdout
    Response


    {
    Return Code: 0
    Key : <None>
    Files : [
    {
    Return Code: 0
    Data :

    PSComputerName : localhost
    RunspaceId : 6c21e9ed-8b52-4751-9536-49a6bf39ecb3
    BACKUPDESTination : TSM
    CLIENTAccessserver :
    DAGNODe :
    DATEformat : 1
    LANGuage : ENU
    LOCALDSMAgentnode : TOADVM3-EXC2010
    LOGFile : tdpexc.log
    LOGPrune : 60
    MOUNTWait : Yes
    NUMberformat : 1
    REMOTEDSMAgentnode :
    TEMPDBRestorepath :
    TEMPLOGRestorepath :
    TIMEformat : 1
    IMPORTVSSSNAPSHOTSONLYWhenneeded : No
    STOREMAILBOXInfo : Yes
    STOPservicesonir : Yes
    USEADFORALIASSEARCH :

    }
    {
      Return Code: 0
      Data       :
    }
    

    ]
    }

    C:\STAF>

     

Log in to post a comment.