News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Power Shell Development

Started by Zen, October 02, 2016, 09:04:28 AM

Previous topic - Next topic

Zen

So,...I've been reading recently,...and, I've learned that it is possible (well,...maybe) to write a Power Shell application.
Windows PowerShell Reference, MSDN

...Yes,...this is but another of my completely insane ideas,... :bgrin:
Have any of you guys ever attempted this (and, lived to tell) ???

Background:
Quote from: Windows PowerShell ReferenceWindows PowerShell is a Microsoft .NET Framework-connected environment designed for administrative automation.

...Of course,...Power Shell already exists: Scripting with Windows PowerShell, MSDN,...and, many of you guys have undoubtedly used it.
It's fun,...isn't it ???
On my system (Windows Seven), it lives here: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

System.Management.Automation Namespace, MSDN
PowerShell Managed Assemblies Reference, MSDN

...Conceptually,...this would be a never-ending, MASM Assembly language, unmanaged, COM-Interop/.NET Framework source code debacle, that would undoubtedly require several lifetimes to code successfully. Funding would be supplied by a mysterious, shadowy organization. :bgrin:
I will, naturally,...take out HUGE life insurance policies on all the participants,...:bgrin:

IS EVERYBODY IN ??? THIS IS A FANTASTIC OPPORTUNITY.

hutch--

From what I have seen of PowerShell, I am glad that I prefer CMD.EXE as a general purpose command line interface.

Vortex

PowerShell is crap. It's a bloated software based on .NET Framework. There are serious complaints reporting degraded performance of login scripts based on PowerShell in a Windows domain environment. Me too, I prefer cmd.exe as it's lighter and faster than PowerShell. It's true that cmd is lacking some important features. To improve it, you can use the tools supplied with the Cygwin project. A better alternative is to write small command-line tools with the assembly language.

GoneFishing

Hi Zen,

That's right . Powershell can be a nice toy to play with , esp. when you're young  and rich and have lots of free time .
Here    I wrote about  PS and its practical use in MASM COM development.

BTW you didn't mention  ISE - Integrated Scripting Environment shipped with PS . That's what i like the most !

Quote from: Zen on October 02, 2016, 09:04:28 AM
...
Funding would be supplied by a mysterious, shadowy organization. :bgrin:
...

M$ I guess  :biggrin:

GoneFishing

Quote from: Vortex on October 02, 2016, 08:51:55 PM
...
It's true that cmd is lacking some important features. To improve it, you can use the tools supplied with the Cygwin project. A better alternative is to write small command-line tools with the assembly language.

or use advanced and powerfull CMD replacement  like Take Command
I used to play with JPSOFT'S  4NT package . Tons of fun !
Of course , I must confess  that I'm totally free from all the troubles of system administration and code for fun only .

Vortex

Hi GoneFishing,

Take Command looks interesting and powerful. Thanks.

Here is a screenshot of a Cygwin session. I managed to build a small portable Cygwin package weighting 37 Mb.


TWell

Coming soon?
https://techcrunch.com/2016/03/30/be-very-afraid-hell-has-frozen-over-bash-is-coming-to-windows-10/

anta40

Cygwin is definitely a very good option... but probably only if you deal a lot with compiling open source softwares.
Nowadays I use ConEmu as the CMD.exe replacement.

;)

Vortex

Bash version of MS runs only on 64-bit Windows 10. No support for 32-bit at least for the moment.

Some important notes :

QuoteThere are some limitations here. This won't work with server software, and it won't work with graphical software. It's intended for developers who want to run Linux command-line utilities on Windows. These applications get access to the Windows file system, but you can't use Bash commands to automate normal Windows programs, or launch Bash commands from the standard Windows command-line. They get access to the same Windows file system, but that's it. Not every command-line application will work, either, as this feature is still in beta./

http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/

Cygwin does not suffer from those restrictions. A quick example, running a Windows command, ipconfig from Bash :

Administrator@orion ~
$ ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   IP Address. . . . . . . . . . . . : 192.168.0.24
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1

Administrator@orion ~
$ ipconfig | grep "IP Address"
   IP Address. . . . . . . . . . . . : 192.168.0.24

Administrator@orion ~
$ notepad &
[1] 2284

Administrator@orion ~
$ ps
      PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
     1740    1060    1740       1904  pty0      197108 14:07:55 /usr/bin/ps
     1060    1408    1060       1696  pty0      197108 14:05:59 /usr/bin/bash
     1408       1    1408       1408  ?         197108 14:05:59 /usr/bin/mintty
     2284    1060    2284       2676  pty0      197108 14:06:55 /cygdrive/c/WINDOWS/system32/notepad


Running a Bash script from cmd :


D:\>type \cygwin\home\Administrator\test.sh
pwd
ipconfig

D:\>\cygwin\bin\bash --login -i ~/test.sh
/home/Administrator

Windows IP Configuration


Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   IP Address. . . . . . . . . . . . : 192.168.0.24
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1

Zen

Amazing !!! Thanks, you guys for the EXCELLENT INTEL. :bgrin:
The idea for a MASM version, .NET Framework PowerShell application was kind of a joke,...as I'm sure you all are aware.
I was just thinking of exploring the namespace and security, to see how it was implemented.

...To be honest, I've never used PowerShell,...and I know almost nothing about it,...

jcfuller


The latest Windows 10, Version 1703, does not provide a command window option from File Explore with a shift/right click.  Instead you get a PowerShell option. I understand there is a way to get a command window from File Explorer but it is pia resgistry hack.
Of course cmd.exe is still available but I used the shift/right click a lot.

Most all my coding uses batch files to compile and link so I was curious if PowerShell offered advantages. I've got a PowerShell introductory book coming today. Now if I can only find the time to read it.


James