Can You Run a Powershell Script From Cache?

476 views
Skip to first unread message

Tom Fitzgibbon

unread,
Mar 19, 2015, 2:11:27 PM3/19/15
to intersystems...@googlegroups.com
I am reposting below.  No winners so far.  Yes I know I can s x=$zf(-1,"dir") to run a command line script.  How about running a Powershell script?

Tom Fitzgibbon | Multidata | 212-967-6700 x537


On Wednesday, August 18, 2010 at 9:22:47 AM UTC-4, Tom Fitzgibbon wrote:
I'll send anyone $10 who can run a PowerShell 
script called by Cache (and share the technique). - Tom 

Jason Warner

unread,
Mar 19, 2015, 2:51:52 PM3/19/15
to intersystems...@googlegroups.com
Have you tried

s x = $zf(-1, "powershell -file c:\dev\test.ps1")

This will only work for PowerShell 2, I can't remember the command line
for PowerShell 1.

Jason
> --
> --
> Caché, Ensemble, DeepSee
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Caché, Ensemble, DeepSee" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to intersystems-publi...@googlegroups.com
> <mailto:intersystems-publi...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

OldMster

unread,
Mar 19, 2015, 2:56:10 PM3/19/15
to intersystems...@googlegroups.com
That has worked for me in the past.  You may need the full path to the powershell executable if the environment doesn't have it in the default path.
Mark


On Thursday, March 19, 2015 at 2:51:52 PM UTC-4, Jason wrote:
Have you tried

s x = $zf(-1, "powershell -file c:\dev\test.ps1")

This will only work for PowerShell 2, I can't remember the command line
for PowerShell 1.

Jason

On 3/19/2015 12:11 PM, Tom Fitzgibbon wrote:
> I am reposting below.  No winners so far.  Yes I know I can s
> x=$zf(-1,"dir") to run a command line script.  How about running a
> Powershell script?
>
> Tom Fitzgibbon | Multidata | 212-967-6700 x537
>
>
> On Wednesday, August 18, 2010 at 9:22:47 AM UTC-4, Tom Fitzgibbon wrote:
>
>     I'll send anyone $10 who can run a PowerShell
>     script called by Cache (and share the technique). - Tom
>
> --
> --
> Caché, Ensemble, DeepSee
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Caché, Ensemble, DeepSee" group.
> To unsubscribe from this group and stop receiving emails from it, send

Fukatko, Martin

unread,
Mar 19, 2015, 3:18:42 PM3/19/15
to intersystems...@googlegroups.com

Or you can use pipes. See

OPEN Command for Interprocess Communication

 

Martin

> For more options, visit https://groups.google.com/d/optout.

--

--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.

To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.

Keith Avery

unread,
Mar 19, 2015, 3:28:22 PM3/19/15
to intersystems...@googlegroups.com

Tom,

 

Here’s an example of how to display the results of the Powershell ‘get-alias’ command:

 

>s cmd="powershell –Command get-alias"

 

>o cmd:"QR" f i=0:1 {u cmd r x q:$zeof||(x=""&&i)  u 0 w x,!} c cmd

 

-Keith

--

--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



The information contained in this email may be confidential and/or may be covered under the Privacy Act, 5 USC 552(a), and/or the Health Insurance Portability and Accountability Act (PL 104-191) and its various implementing regulations and must be protected in accordance with those provisions.. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please contact the sender by reply email and destroy all copies of the original message. To contact our email administrator directly, send an email message to help...@medsphere.com. Thank you.

Tom Fitzgibbon

unread,
Mar 19, 2015, 4:42:32 PM3/19/15
to intersystems...@googlegroups.com
Thanks, I will try these methods.  First one that works get $10. - Tom

You received this message because you are subscribed to a topic in the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/intersystems-public-cache/IcSKxZJnpmg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to intersystems-publi...@googlegroups.com.

RIC

unread,
Mar 19, 2015, 4:56:26 PM3/19/15
to intersystems...@googlegroups.com
 
Hello all,
 
this worked for me
 
USER>! powershell -file c:\MyScripts\FirstPowershell.ps1

Fukatko, Martin

unread,
Mar 20, 2015, 4:24:32 AM3/20/15
to intersystems...@googlegroups.com

I had to strengthen Keith's code

 

s eofError=$system.Process.SetZEOF(1)

s cmd="powershell –Command get-alias"

o cmd:"QR" f i=0:1 {u cmd r x q:$zeof||(x=""&&i)  u 0 w x,!} c cmd

d $system.Process.SetZEOF(eofError)

 

And it works for me without error now.

 

Martin

 

From: intersystems...@googlegroups.com [mailto:intersystems...@googlegroups.com] On Behalf Of Tom Fitzgibbon


Sent: Thursday, March 19, 2015 9:42 PM
To: intersystems...@googlegroups.com

Reply all
Reply to author
Forward
0 new messages