Windows Vista Forums

Remote Interactive Shell?
  1. #1


    Gerry Hickman Guest

    Remote Interactive Shell?

    Hi,

    How can I connect to, and interact with, a remote Windows shell?

    e.g.



    1. Connect to six servers in turn (using impersonation)
    2. Run ipconfig /all
    3. See the results of the above command on the console I'm sitting at

    Before PowerShell there were options like RCMD.EXE and PsExec, but both
    have limitations and dependencies such as services being installed to
    the remote machines. PsExec (above v1.70) has some serious problems with
    programmatic redirection of StdOut over named pipes.

    On Linux, it's always been "built-in"; the whole thing is engineered to
    be able to work without a UI. Windows 2008 now has a "command-line only"
    option, but I'm not convinced Microsoft's command-line tools are ready yet.

    As I look after thousands of computers, I don't really want to have to
    install and maintain an "agent" on every machine, I want it to work "out
    of the box" without 3rd party add-ons.

    --
    Gerry Hickman (London UK)

      My System SpecsSystem Spec

  2. #2


    Oisin (x0n) Grehan [MVP] Guest

    Re: Remote Interactive Shell?

    On Mar 4, 2:40*pm, Gerry Hickman <gerry66...@xxxxxx> wrote:

    > Hi,
    >
    > How can I connect to, and interact with, aremoteWindows shell?
    >
    > e.g.
    >
    > 1. Connect to six servers in turn (using impersonation)
    > 2. Runipconfig/all
    > 3. See the results of the above command on the console I'm sitting at
    >
    > Before PowerShell there were options like RCMD.EXE and PsExec, but both
    > have limitations and dependencies such as services being installed to
    > theremotemachines. PsExec (above v1.70) has some serious problems with
    > programmatic redirection of StdOut over named pipes.
    >
    > On Linux, it's always been "built-in"; the whole thing is engineered to
    > be able to work without a UI. Windows 2008 now has a "command-line only"
    > option, but I'm not convinced Microsoft's command-line tools are ready yet..
    >
    > As I look after thousands of computers, I don't really want to have to
    > install and maintain an "agent" on every machine, I want it to work "out
    > of the box" without 3rd party add-ons.
    >
    > --
    > Gerry Hickman (London UK)
    Hi Gerry,

    For this particular example, you can use get-wmiobject command in
    powershell. It's not a general solution to this problem of remote
    shells, but works for this particular case:

    ps> gwmi Win32_NetworkAdapterConfiguration -computer SERVERNAME

    hope this helps,

    - Oisin

      My System SpecsSystem Spec

  3. #3


    Gerry Hickman Guest

    Re: Remote Interactive Shell?

    Hi Oisin,

    >> How can I connect to, and interact with, aremoteWindows shell?

    > For this particular example, you can use get-wmiobject command in
    > powershell. It's not a general solution to this problem of remote
    > shells, but works for this particular case:
    >
    > ps> gwmi Win32_NetworkAdapterConfiguration -computer SERVERNAME
    No, this isn't what I'm talking about. I'm talking about a REMOTE
    INTERACTIVE CMD SHELL, where I issue a command and the results of that
    command are sent back to the Administration Console. The IPconfig was
    just an example of a command-line utility. A different example would be
    netsh where I can actually be in the netsh session on the remote machine
    setting parameters.

    I'm assuming "PowerShell" has this facility, otherwise the prefix
    "Power" would be meaningless, and the "Shell" part would be laughable...

    I can't believe I even have to explain this, it's like I've just logged
    into "Noddy's first Computer" or something.

    Is this supposed to be a Microsoft "Managed" newsgroup? If no, why not?
    Isn't PowerShell important enough?

    --
    Gerry Hickman (London UK)

      My System SpecsSystem Spec

  4. #4


    Brandon Shell [MVP] Guest

    Re: Remote Interactive Shell?

    I will answer in-line

    >> I'm assuming "PowerShell" has this facility, otherwise the prefix "Power"
    would be meaningless, and the "Shell" part would be laughable...

    It does NOT have this facility, but will be provided in v2. As for your commentary
    on what makes it "Power" and what makes it a "Shell." There is no main stream
    shell that provides what you’re asking for without third party interaction.
    Even with Linux. You MUST have SSHD installed and configured. Hardly what
    I call "Out of the Box." I manage about 400+ machines and I do it all from
    one central machine. The key isn't remote shell. The key is understanding
    what data you want and how to get it. Perhaps that is the question you should
    ask.

    >> I can't believe I even have to explain this, it's like I've just logged
    into "Noddy's first Computer" or something.
    This NG's fields all sorts of people of different levels of technical knowledge.
    I for one would prefer to be sure before I assume what you want.

    >> Is this supposed to be a Microsoft "Managed" newsgroup? If no, why not?
    Isn't PowerShell important enough?
    MS frequent this NG. You just posted 2hrs ago. If they see the post and it
    has not be answered they will answer it.

    What makes Powershell Powerful is the 'object' nature of the shell. BASH/KSH
    and such cannot even touch the power you get with just Powershell alone.
    They are not even in the same ball park.

    As a side note... Messages don't always come across right, but you seem awfully
    grumpy. If that is not your intent, you should be careful how you word you
    messages. If you meant to be grumpy... just disregard this message completely
    as it is a waste of both our time.



      My System SpecsSystem Spec

  5. #5


    Jon Guest

    Re: Remote Interactive Shell?

    This is perfectly possible in Powershell. You write small wrapper functions
    around 'winrs' and use a few little tricks on the remote machine. I have a
    suite of such functions I use here for opening remote cmd.exe,
    powershell.exe prompts, running remote scripts and far more besides.

    In version 1 this isn't entirely spoon-fed to you - you have to read the
    documentation and manuals for both Powershell and winrs, and compose your
    own such functions. Version 2 is likely to be a lot easier for those who
    prefer their shoelaces to be tied for them.

    It's still early days for Powershell, but it is most definitely powerful,
    and its value will undoubtedly emerge.

    --
    Jon


    "Gerry Hickman" <gerry666uk@xxxxxx> wrote in message
    news:%23oUdMpjfIHA.4436@xxxxxx

    > Hi Oisin,
    >

    >>> How can I connect to, and interact with, aremoteWindows shell?
    >

    >> For this particular example, you can use get-wmiobject command in
    >> powershell. It's not a general solution to this problem of remote
    >> shells, but works for this particular case:
    >>
    >> ps> gwmi Win32_NetworkAdapterConfiguration -computer SERVERNAME
    >
    > No, this isn't what I'm talking about. I'm talking about a REMOTE
    > INTERACTIVE CMD SHELL, where I issue a command and the results of that
    > command are sent back to the Administration Console. The IPconfig was just
    > an example of a command-line utility. A different example would be netsh
    > where I can actually be in the netsh session on the remote machine setting
    > parameters.
    >
    > I'm assuming "PowerShell" has this facility, otherwise the prefix "Power"
    > would be meaningless, and the "Shell" part would be laughable...
    >
    > I can't believe I even have to explain this, it's like I've just logged
    > into "Noddy's first Computer" or something.
    >
    > Is this supposed to be a Microsoft "Managed" newsgroup? If no, why not?
    > Isn't PowerShell important enough?
    >
    > --
    > Gerry Hickman (London UK)

      My System SpecsSystem Spec

  6. #6


    Gerry Hickman Guest

    Re: Remote Interactive Shell?

    Hi Jon,

    I've just found this article

    http://blogs.technet.com/server_core...11/446122.aspx

    I'm not sure v2 of PowerShell really changes this; you still have to
    configure every server before you can use the remoting.

    The comments on the blog page are interesting and pretty much reflect my
    own comments and questions. Note the catch-22 nature of it, security
    concerns and the references to PsExec and SSH. PsExec has the advantage
    that it does NOT require prior server-side configuration.

    This article is also worth a look

    http://www.microsoft.com/technet/scr...sh/remote.mspx

    but notice how they gloss over the details.

    Compared to SSH on Linux, this is messy, slow and backward.

    Jon wrote:

    > This is perfectly possible in Powershell. You write small wrapper
    > functions around 'winrs' and use a few little tricks on the remote
    > machine. I have a suite of such functions I use here for opening remote
    > cmd.exe, powershell.exe prompts, running remote scripts and far more
    > besides.
    >
    > In version 1 this isn't entirely spoon-fed to you - you have to read the
    > documentation and manuals for both Powershell and winrs, and compose
    > your own such functions. Version 2 is likely to be a lot easier for
    > those who prefer their shoelaces to be tied for them.
    >
    > It's still early days for Powershell, but it is most definitely
    > powerful, and its value will undoubtedly emerge.
    >

    --
    Gerry Hickman (London UK)

      My System SpecsSystem Spec

  7. #7


    Oisin (x0n) Grehan [MVP] Guest

    Re: Remote Interactive Shell?

    On Mar 5, 6:45*pm, Gerry Hickman <gerry66...@xxxxxx> wrote:

    > Hi Jon,
    >
    > I've just found this article
    >
    > http://blogs.technet.com/server_core...11/446122.aspx
    >
    > I'm not sure v2 of PowerShell really changes this; you still have to
    > configure every server before you can use the remoting.
    >
    > The comments on the blog page are interesting and pretty much reflect my
    > own comments and questions. Note the catch-22 nature of it, security
    > concerns and the references to PsExec and SSH. PsExec has the advantage
    > that it does NOT require prior server-side configuration.
    >
    > This article is also worth a look
    >
    > http://www.microsoft.com/technet/scr...sh/remote.mspx
    >
    > but notice how they gloss over the details.
    >
    > Compared to SSH on Linux, this is messy, slow and backward.
    >
    > Jon wrote:

    > > This is perfectly possible in Powershell. You write small wrapper
    > > functions around 'winrs' and use a few little tricks on the remote
    > > machine. I have a suite of such functions I use here for opening remote
    > > cmd.exe, powershell.exe prompts, running remote scripts and far more
    > > besides.
    >

    > > In version 1 this isn't entirely spoon-fed to you - you have to read the
    > > documentation and manuals for both Powershell and winrs, and compose
    > > your own such functions. Version 2 is likely to be a lot easier for
    > > those who prefer their shoelaces to be tied for them.
    >

    > > It's still early days for Powershell, but it is most definitely
    > > powerful, and its value will undoubtedly emerge.
    >
    > --
    > Gerry Hickman (London UK)
    Hi Gerry,

    I know you're just ranting and I sympathise, truely, but come on
    now...

    >As I look after thousands of computers, I don't really want to have to
    >install and maintain an "agent" on every machine, I want it to work "out
    >of the box" without 3rd party add-ons.
    >
    > Compared to SSH on Linux, this is messy, slow and backward.
    ...is complete nonsense. SSHd is an agent. It requires maintanence
    ( http://www.google.ca/search?q=sshd+advisories ) and some might argue
    that it is messy ( http://www.google.ca/search?q=sshd+frustrating ),
    slow ( http://www.google.ca/search?hl=en&q=sshd+slow ) and backwards
    ( http://en.wikipedia.org/wiki/IPsec ).

    and saying:

    >On Linux, it's always been "built-in"
    ...is a bit of a trick answer. Arguably 90% of the components of gnu/
    linux are 3rd party. You must _choose_ to install them at build time.

    Having said that, I'm here to help. Just take your time and learn the
    product. It's complex. It's not bash. There's a great community here
    will to help with your problems on their own time, so take advantage
    of it.

    - Oisin
    Microsoft MVP
    http://www.nivot.org

      My System SpecsSystem Spec

  8. #8


    Gerry Hickman Guest

    Re: Remote Interactive Shell?

    Hi Brandon,

    >>> I'm assuming "PowerShell" has this facility, otherwise the prefix
    >>> "Power"
    > would be meaningless, and the "Shell" part would be laughable...

    > It does NOT have this facility, but will be provided in v2.
    Not fully, but what you say about v2 is highly valid in the context of
    what I'm asking. The point is, the authors of PS obviously think what
    I'm saying is important, because every v2 related blog is banging on
    about remoting.

    > As for your
    > commentary on what makes it "Power" and what makes it a "Shell." There
    > is no main stream shell that provides what you’re asking for without
    > third party interaction.
    Sure there is, PsExec 1.70

    Much more powerful than PowerShell because it's "just works". The
    "remoting" has been around for years. The PS team are lagging behind.

    > Even with Linux. You MUST have SSHD installed
    > and configured. Hardly what I call "Out of the Box."
    But SSH is open source and fully documented; this means it's very easy
    to configure for thousands of PCs. Microsoft change their "remote"
    options with the wind. The latest fad is win-rm (or what ever it's
    called) and it's not installed by default so obviously isn't much good
    and obviously isn't something they are pushing very hard. They'll also
    blame customers if it gets hacked for daring to install it.

    > I manage about
    > 400+ machines and I do it all from one central machine. The key isn't
    > remote shell. The key is understanding what data you want and how to get
    > it. Perhaps that is the question you should ask.
    I don't want any "data". What I want is remote shell. e.g. run a BAT
    file on admin box that connects to 400 boxes and runs an exe on that box
    and send the output back.

    > What makes Powershell Powerful is the 'object' nature of the shell.
    I don't agree. Can you elaborate on this?

    > BASH/KSH and such cannot even touch the power you get with just
    > Powershell alone. They are not even in the same ball park.
    ??

    --
    Gerry Hickman (London UK)

      My System SpecsSystem Spec

  9. #9


    Brandon Shell [MVP] Guest

    Re: Remote Interactive Shell?

    >"Not fully, but what you say about v2 is highly valid in the context of
    what I'm asking. The point is, the authors of PS obviously think what I'm
    saying is important, > because every v2 related blog is banging on about
    remoting."
    Remoting is important, but it is far from the only thing you need. As I have
    said... I manage all my machines from one location using WMI and .NET in
    Powershell. I get things 10x faster than anyone else.

    > "Sure there is, PsExec 1.70"
    PsExec 1.70 is not a shell. It a program. There is huge difference. Don't
    get me wrong... remoting commands is very useful, but to say that is more
    powerfull than even MS DOS is an overstatement. That is single purpose app.
    You can do the same thing with .NET

    > "But SSH is open source and fully documented; this means it's very easy
    to configure for thousands of PCs. Microsoft change their "remote" options
    with the wind. > The latest fad is win-rm (or what ever it's called) and
    it's not installed by default so obviously isn't much good and obviously
    isn't something they are pushing very > hard. They'll also blame customers
    if it gets hacked for daring to install it."
    It seems to me you take something comfortable for you and paint a broad stroke
    that is easy. SSH is not useful unless setup correctly. And configuring properly
    is not a simple task.

    > "I don't want any "data". What I want is remote shell. e.g. run a BAT file
    on admin box that connects to 400 boxes and runs an exe on that box and send
    the

    > output back."
    Im curious... what do you want a remote shell for? I am sure you have a purpose.
    My point is just because Powershell is different doesnt make it wrong. I
    personally think having to touch 400 machines is ineffiecent and a waste
    of time. It also has a slew of dependancies and doesnt scale well at all.

    > "What makes Powershell Powerful is the 'object' nature of the shell. "
    > "I don't agree. Can you elaborate on this?"
    This is pretty easy. Lets take a real life example.
    Boss: Joe, We are running out of space and I am NOT buying anymore space.
    CLEAN IT UP!
    Joe: Yes, Sir
    Joe: Opens Powershell Prompt
    PS> Get-Childitem d:\DataShare -recurce | ?{$_.LastAccessTime -lt (get-date).addmonths(-6)}
    | %{$_.fullname}
    Joe: Gets back a list of all the files that havent been accessed in 6months.
    Gives to his Boss.
    Boss: Delete any file in that list greater than 100mb
    Joe: Yes Sir.
    Joe: Goes back to Powershell prompt and presses up arrow and changes it
    PS> Get-Childitem d:\DataShare -recurce | ?{($_.LastAccessTime -lt (get-date).addmonths(-6))
    -and ($_.length -gt 100mb)} | remove-item -whatif
    Joe: Screen shows him it would delete 300 files. Presses up arrow again and
    removes the -whatif
    Joe: Hey Boss, I delete 30gb of data.

    This is possible because when you do Get-Childitem you get back an object
    with properties like LastAccessTime and Length. Object base shell removes
    the need to do about 90% of the text parsing.

    > "BASH/KSH and such cannot even touch the power you get with just Powershell
    alone. They are not even in the same ball park. "

    > "??"
    My point is the BASH and KSH are subpar shells when compared to Powershell.
    In fact the only thing that makes them usable is all the "third party" utilities
    that have been built over the years.

    The Moral of the story is that the Shell has been WAY over due for a make
    over. Powershell does just that. Is it perfect, no. But is way better than
    anything else out there.

    Brandon Shell
    ---------------
    Blog: http://www.bsonposh.com/
    PSH Scripts Project: www.codeplex.com/psobject

    GH> PsExec 1.70
    GH>



      My System SpecsSystem Spec

  10. #10


    Brandon Shell [MVP] Guest

    Re: Remote Interactive Shell?

    My Reader really hosed up that post... let me know if you need any
    clarification

    --
    Brandon Shell [MVP]
    ----------------------
    Blog: http://www.bsonposh.com/
    PSH Scripts Project: www.codeplex.com/psobject
    --------------------------------------

    "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
    news:29d4f64647218ca4db8725acbca@xxxxxx

    > >"Not fully, but what you say about v2 is highly valid in the context of
    > what I'm asking. The point is, the authors of PS obviously think what I'm
    > saying is important, > because every v2 related blog is banging on about
    > remoting."
    > Remoting is important, but it is far from the only thing you need. As I
    > have said... I manage all my machines from one location using WMI and .NET
    > in Powershell. I get things 10x faster than anyone else.
    >

    >> "Sure there is, PsExec 1.70"
    > PsExec 1.70 is not a shell. It a program. There is huge difference. Don't
    > get me wrong... remoting commands is very useful, but to say that is more
    > powerfull than even MS DOS is an overstatement. That is single purpose
    > app. You can do the same thing with .NET
    >

    >> "But SSH is open source and fully documented; this means it's very easy
    > to configure for thousands of PCs. Microsoft change their "remote" options
    > with the wind. > The latest fad is win-rm (or what ever it's called) and
    > it's not installed by default so obviously isn't much good and obviously
    > isn't something they are pushing very > hard. They'll also blame customers
    > if it gets hacked for daring to install it."
    > It seems to me you take something comfortable for you and paint a broad
    > stroke that is easy. SSH is not useful unless setup correctly. And
    > configuring properly is not a simple task.
    >

    >> "I don't want any "data". What I want is remote shell. e.g. run a BAT
    >> file
    > on admin box that connects to 400 boxes and runs an exe on that box and
    > send the

    >> output back."
    > Im curious... what do you want a remote shell for? I am sure you have a
    > purpose. My point is just because Powershell is different doesnt make it
    > wrong. I personally think having to touch 400 machines is ineffiecent and
    > a waste of time. It also has a slew of dependancies and doesnt scale well
    > at all.
    >

    >> "What makes Powershell Powerful is the 'object' nature of the shell. "
    >> "I don't agree. Can you elaborate on this?"
    > This is pretty easy. Lets take a real life example.
    > Boss: Joe, We are running out of space and I am NOT buying anymore space.
    > CLEAN IT UP!
    > Joe: Yes, Sir
    > Joe: Opens Powershell Prompt
    > PS> Get-Childitem d:\DataShare -recurce | ?{$_.LastAccessTime -lt
    > (get-date).addmonths(-6)} | %{$_.fullname}
    > Joe: Gets back a list of all the files that havent been accessed in
    > 6months. Gives to his Boss.
    > Boss: Delete any file in that list greater than 100mb
    > Joe: Yes Sir.
    > Joe: Goes back to Powershell prompt and presses up arrow and changes it
    > PS> Get-Childitem d:\DataShare -recurce | ?{($_.LastAccessTime -lt
    > (get-date).addmonths(-6)) -and ($_.length -gt 100mb)} |
    > remove-item -whatif
    > Joe: Screen shows him it would delete 300 files. Presses up arrow again
    > and removes the -whatif
    > Joe: Hey Boss, I delete 30gb of data.
    >
    > This is possible because when you do Get-Childitem you get back an object
    > with properties like LastAccessTime and Length. Object base shell removes
    > the need to do about 90% of the text parsing.
    >

    >> "BASH/KSH and such cannot even touch the power you get with just
    >> Powershell
    > alone. They are not even in the same ball park. "

    >> "??"
    > My point is the BASH and KSH are subpar shells when compared to
    > Powershell. In fact the only thing that makes them usable is all the
    > "third party" utilities that have been built over the years.
    >
    > The Moral of the story is that the Shell has been WAY over due for a make
    > over. Powershell does just that. Is it perfect, no. But is way better than
    > anything else out there.
    >
    > Brandon Shell
    > ---------------
    > Blog: http://www.bsonposh.com/
    > PSH Scripts Project: www.codeplex.com/psobject
    >
    > GH> PsExec 1.70
    > GH>
    >
    >

      My System SpecsSystem Spec

Page 1 of 2 12 LastLast
Remote Interactive Shell? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can parent shell monitor run/crash status of Child shell/exe ? sanjeev kumar PowerShell 3 11 Sep 2009
Why is power shell exclusively interactive? NKX PowerShell 6 24 Sep 2007
Why is Power Shell exclusively interactive? NKX PowerShell 2 19 Sep 2007
Executing Power Shell Scripts from Windows Shell Mugunth PowerShell 3 02 May 2007
Shell extension - how do I disable the preview pane for my shell e Trurl Aero 2 04 Mar 2006