Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - PS Console when invoking a script from VB.NET

Reply
 
Old 07-28-2007   #1 (permalink)
Dan


 
 

PS Console when invoking a script from VB.NET

In a VB program I use the following statement:
Shell("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit " _
+ arg1 + " " + arg2, AppWinStyle.MaximizedFocus, True)
This works fine on my Vista where it brings up the PS console and I can do
the debugging.

Not so on Win 2003 where the Console does not appear.

What should I change in the settings on 2003?

Thank you very much,
Dan


My System SpecsSystem Spec
Old 07-28-2007   #2 (permalink)
RichS


 
 

RE: PS Console when invoking a script from VB.NET

I assume that PowerShell.exe actually exists at the path you have given on
your Win 2003 machine
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"Dan" wrote:

> In a VB program I use the following statement:
> Shell("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit " _
> + arg1 + " " + arg2, AppWinStyle.MaximizedFocus, True)
> This works fine on my Vista where it brings up the PS console and I can do
> the debugging.
>
> Not so on Win 2003 where the Console does not appear.
>
> What should I change in the settings on 2003?
>
> Thank you very much,
> Dan
>

My System SpecsSystem Spec
Old 07-28-2007   #3 (permalink)
Dan


 
 

RE: PS Console when invoking a script from VB.NET

Indeed it is there and the script is executed only the PS Console does not
appear.
Thanks,
Dan
==========================================

"RichS" wrote:

> I assume that PowerShell.exe actually exists at the path you have given on
> your Win 2003 machine
> --
> Richard Siddaway
> Please note that all scripts are supplied "as is" and with no warranty
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "Dan" wrote:
>
> > In a VB program I use the following statement:
> > Shell("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit " _
> > + arg1 + " " + arg2, AppWinStyle.MaximizedFocus, True)
> > This works fine on my Vista where it brings up the PS console and I can do
> > the debugging.
> >
> > Not so on Win 2003 where the Console does not appear.
> >
> > What should I change in the settings on 2003?
> >
> > Thank you very much,
> > Dan
> >

My System SpecsSystem Spec
Old 07-28-2007   #4 (permalink)
Shay Levi


 
 

RE: PS Console when invoking a script from VB.NET

Sounds strange. Does the arguments contain spaces or quoting chars? Are they
looks alike on each platform?
Try to run the following on each machine through Start >> Run

c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit

Can you see the console?
Next try to add the arguments and see if it runs as exepected.


Shay
http://scriptolog.blogspot.com



> Indeed it is there and the script is executed only the PS Console does
> not
> appear.
> Thanks,
> Dan
> ==========================================
> "RichS" wrote:
>
>> I assume that PowerShell.exe actually exists at the path you have
>> given on
>> your Win 2003 machine
>> --
>> Richard Siddaway
>> Please note that all scripts are supplied "as is" and with no
>> warranty
>> Blog: http://richardsiddaway.spaces.live.com/
>> PowerShell User Group: http://www.get-psuguk.org.uk
>> "Dan" wrote:
>>
>>> In a VB program I use the following statement:
>>> Shell("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
>>> -noexit " _
>>> + arg1 + " " + arg2, AppWinStyle.MaximizedFocus, True)
>>> This works fine on my Vista where it brings up the PS console and I
>>> can do
>>> the debugging.
>>> Not so on Win 2003 where the Console does not appear.
>>>
>>> What should I change in the settings on 2003?
>>>
>>> Thank you very much,
>>> Dan



My System SpecsSystem Spec
Old 07-29-2007   #5 (permalink)
RichS


 
 

RE: PS Console when invoking a script from VB.NET

Could there be a GPO with software restriction or some other permissions
setting peventing it from running?
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"Dan" wrote:

> Indeed it is there and the script is executed only the PS Console does not
> appear.
> Thanks,
> Dan
> ==========================================
>
> "RichS" wrote:
>
> > I assume that PowerShell.exe actually exists at the path you have given on
> > your Win 2003 machine
> > --
> > Richard Siddaway
> > Please note that all scripts are supplied "as is" and with no warranty
> > Blog: http://richardsiddaway.spaces.live.com/
> > PowerShell User Group: http://www.get-psuguk.org.uk
> >
> >
> > "Dan" wrote:
> >
> > > In a VB program I use the following statement:
> > > Shell("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit " _
> > > + arg1 + " " + arg2, AppWinStyle.MaximizedFocus, True)
> > > This works fine on my Vista where it brings up the PS console and I can do
> > > the debugging.
> > >
> > > Not so on Win 2003 where the Console does not appear.
> > >
> > > What should I change in the settings on 2003?
> > >
> > > Thank you very much,
> > > Dan
> > >

My System SpecsSystem Spec
Old 07-30-2007   #6 (permalink)
Dan


 
 

RE: PS Console when invoking a script from VB.NET

The behaviour described initially was when the program was built on Vista and
installed (using msi) on the 2003 server.

When I built the program on the server (without any editing!) it behaved as
expected i.e. the PS console appeared.

Strange indeed!

Thank you all, Dan

"Dan" wrote:

> Indeed it is there and the script is executed only the PS Console does not
> appear.
> Thanks,
> Dan
> ==========================================
>
> "RichS" wrote:
>
> > I assume that PowerShell.exe actually exists at the path you have given on
> > your Win 2003 machine
> > --
> > Richard Siddaway
> > Please note that all scripts are supplied "as is" and with no warranty
> > Blog: http://richardsiddaway.spaces.live.com/
> > PowerShell User Group: http://www.get-psuguk.org.uk
> >
> >
> > "Dan" wrote:
> >
> > > In a VB program I use the following statement:
> > > Shell("c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit " _
> > > + arg1 + " " + arg2, AppWinStyle.MaximizedFocus, True)
> > > This works fine on my Vista where it brings up the PS console and I can do
> > > the debugging.
> > >
> > > Not so on Win 2003 where the Console does not appear.
> > >
> > > What should I change in the settings on 2003?
> > >
> > > Thank you very much,
> > > Dan
> > >

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to run powershell script without console ? PowerShell
Invoking PS script in RunOnce PowerShell
how to call win32 console app or bat file from ps script PowerShell
Hide console and capture output from script? PowerShell
Invoking Powershell from C# PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46