Did you try setting your staf default shell to powershell? I use the following 
In my staf.cfg

Set defaultshell "C:/WINNT/system32/WindowsPowershell/v1.0/powershell.exe -c %c"

George


On May 20, 2011, at 5:23 AM, John Andoh <john.an...@gmail.com> wrote:

> Hi Sharon,
>  
> With the -PSConsoleFile parameter, the STAF command produced a Response code 
> of 75:
>  
> C:\>
> C:\>staf local process start command 
> "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile 
> \"C:\Program Files\Hi\PSSnapin\PSSnapin.psc1" -NoExit .\test.ps1 ; exit" wait 
> returnstderr returnstdout
> Response
> --------
> 75
> C:\>
> C:\>
> 
> What is Response code 75? The code is undefined in this document:
>  
> http://staf.sourceforge.net/current/STAFRC.htm
>  
> Regards,
> John Andoh
> 
>  
> On Thu, May 19, 2011 at 4:18 PM, John Andoh <john.an...@gmail.com> wrote:
> Hi Sharon,
> 
> Thanks for the quick response.
> The command failed and produced the same error message.
> 
> 
> C:\>STAF local PROCESS START SHELL COMMAND "powershell -ExecutionPolicy 
> UNRESTRICTED -command C:\\test.ps1" WAIT RETURNSTDOUT RETURNSTDERR SAMECONSOLE
> Response
> --------
> {
>   Return Code: 0
>   Key        : <None>
>   Files      : [
>     {
>       Return Code: 0
>       Data       :
>     }
>     {
>       Return Code: 0
>       Data       : Add-PSSnapin : No snap-ins have been registered for 
> Windows PowerShell version 2.
> At C:\test.ps1:3 char:13
> + add-pssnapin <<<<  Storage.Management.Powershell.Admin
>     + CategoryInfo          : InvalidArgument: 
> (Storage...owershell.Admin:String) [Add-PSSnapin], PSArgumentException
>     + FullyQualifiedErrorId : 
> AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
> 
> The term 'get-subsystem' is not recognized as the name of a cmdlet, function, 
> script file, or operable program. Check the spelling of the name, or if a 
> path was included, verify that the pa
> th is correct and try again.
> At C:\test.ps1:4 char:14
> + get-subsystem <<<<
>     + CategoryInfo          : ObjectNotFound: (get-subsystem:String) [], 
> CommandNotFoundException
>     + FullyQualifiedErrorId : CommandNotFoundException
> 
> 
>     }
>   ]
> }
> 
> The script is attempting to spawn a process with the snapin and execute a 
> cmdlet implemented by the snapin.
> This capability is available with Shell scripts. How is this function 
> implemented with STAF? Please advise. Thanks!
> 
> Regards,
> John Andoh
> 
> 
> 
> 
> 
> On Thu, May 19, 2011 at 3:50 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
> I don't know anything about Powershell snapins.  But, if you specify the 
> following does it work? 
> 
> C:\>STAF local PROCESS START SHELL COMMAND "powershell -ExecutionPolicy 
> UNRESTRICTED -command C:\\test.ps1" WAIT RETURNSTDOUT RETURNSTDERR 
> SAMECONSOLE 
> 
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin,   luc...@us.ibm.com
> (512) 286-7313 or Tieline 363-7313
> 
> 
> 
> 
> From:        John Andoh <john.an...@gmail.com> 
> To:        staf-users@lists.sourceforge.net 
> Date:        05/19/2011 05:34 PM 
> Subject:        [staf-users] Using STAF with a powershell snapin 
> 
> 
> 
> Dear staf-users,
> 
> I am having problems running a Powershell script, test.ps1, with the "STAF 
> PROCESS START SHELL" command.
> The script loads a Powershell snapin, Storage.Management.Powershell.Admin, 
> and executes a command, get-subsystem, implemented by the snap-in.
> 
> This is the content of the powershell script, test.ps1.
> 
> 
> C:\>type test.ps1
> 
> 
> add-pssnapin Storage.Management.Powershell.Admin
> get-subsystem
> C:\>
> C:\>
> 
> This is the expected result for running the script in the DOS command prompt:
> 
> 
> C:\>powershell.exe -ExecutionPolicy UNRESTRICTED -command c:\test.ps1
> 
> There is no subsystems added.
> 
> 
> However, if the powershell script is run with "STAF PROCESS START SHELL" 
> command, I ran into problems registering the snapin, as seen from the error 
> messages below:
> 
> 
> 
> C:\>STAF local PROCESS START SHELL "powershell.exe -ExecutionPolicy 
> UNRESTRICTED -command %c" COMMAND c:\test.ps1 WAIT RETURNSTDOUT RETURNSTDERR  
> SAMECONSOLE
> Response
> --------
> {
>   Return Code: 0
>   Key        : <None>
>   Files      : [
>     {
>       Return Code: 0
>       Data       :
>     }
>     {
>       Return Code: 0
>       Data       : Add-PSSnapin : No snap-ins have been registered for 
> Windows PowerShell version 2.
> At C:\test.ps1:3 char:13
> + add-pssnapin <<<<  Storage.Management.Powershell.Admin
>     + CategoryInfo          : InvalidArgument: 
> (Storage...owershell.Admin:String) [Add-PSSnapin], PSArgumentException
>     + FullyQualifiedErrorId : 
> AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
> 
> The term 'get-subsystem' is not recognized as the name of a cmdlet, function, 
> script file, or operable program. Check the spelling of the name, or if a 
> path was included, verify that the pa
> th is correct and try again.
> At C:\test.ps1:4 char:14
> + get-subsystem <<<<
>     + CategoryInfo          : ObjectNotFound: (get-subsystem:String) [], 
> CommandNotFoundException
>     + FullyQualifiedErrorId : CommandNotFoundException
> 
> 
>     }
>   ]
> }
> 
> C:\>
> 
> 
> I will appreciate your help to resolve this problem. Thanks.
> 
> 
> Regards,
> John Andoh
> 
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its 
> next-generation tools to help Windows* and Linux* C/C++ and Fortran 
> developers boost performance applications - including clusters. 
> http://p.sf.net/sfu/intel-dev2devmay_______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
> 
> 
> 
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its 
> next-generation tools to help Windows* and Linux* C/C++ and Fortran 
> developers boost performance applications - including clusters. 
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to