PowerShell Remoting
sconstantinou.com
sconstantinou.com
Now that Windows 10 and above support native SSH with a somewhat-real pseudo terminal, we can probably just use SSH instead in the next year or two without having to pay Bitvise a ton of cash
It uses DCE-RPC which is not trivial, but I believe it is certainly more compact than SOAP and such. The main advantage is the server component is built-in.
It sounds super complex to setup.
I have more serious griefs against powershell remoting.
For instance it is set up as a delayed start service which means you often have to wait more than a minute after a VM rebooted before you can log into it.
Windows Update is accessible by remoting through a COM API that doesn’t allow remote connections, so you can’t do the equivalent of a simple apt-get update remotely. There are horrible hacks around it, like setting up a scheduled task to trigger or collect the update and run that task from remoting and collecting the result some random way like reading a text file.
It really feels half baked, barely usable, and an ugly reminder that CLI has been added to windows as an after thought.
[edit] also I believe it is unencrypted by default. You have to enable https, which isn't straightforward. And you can't change the default ports.
This isn't even remotely related to PowerShell (no pun intended), it's a security based decision of the windows update API. You can say that it is annoying, stupid and cause of hacks that are much less secure than opening remote operations to the API, and I will agree with you. But it isn't PowerShell business.
As as side note If you are using SCCM you can use WMI for windows update.
PowerShell is far from being half baked, it is a first class citizen in Windows, all the OS GUI tools today executes operations through PowerShell. Many let you see the commands so you can bypass the gui next time and run the commands yourself. As a matter of fact, many things these days can only be done by the shell, while the GUI only expose limited set of the available API.
I highly doubt that this is this the case.
>The fact is Microsoft delivered an ssh-like scripting capability that cannot do simple things like updating the OS
If you measure PowerShell by its ability to perform OS updates then you are correct, it is a failure. But the fact is that this annoyance isn't caused by the shell being half baked but rather it is an API decision of a different, unrelated product. The shell provides great usability in all other aspects - that is, the whole OS and other Microsoft and 3rd party software.
There were plenty of people cheering when they say they could ssh from powershell to a win box running powershell, just because of how annoying it is.
I'm interested to see whether Windows SSH servers become more viable after ConPTY[0] is widely available.
[0]: https://blogs.msdn.microsoft.com/commandline/2018/08/02/wind...
I'd bet a project like Ansible could use something like that to great effect though.
When I'm on Linux, I have tons of commands, bash, python, perl, Awk, sed...etc etc. All of those tools work perfectly with text which the Unix style OS embraces. Windows on the other hand is all objects and this can be painful in PowerShell at times.
Tldr; PowerShell is alright on Windows as it is the only real viable option for a power user. However, Linux is far better with what it already has and PowerShell would be a step backwards in functionality and efficiency.
I think it'd be better if there was a fully supported way to debug Powershell inside Visual Studio - the IDE is a step backwards.
Doesn't seem like a good idea to default to plaintext.
"Regardless of the transport protocol used (HTTP or HTTPS), PowerShell Remoting always encrypts all communication after initial authentication with a per-session AES-256 symmetric key."
https://docs.microsoft.com/en-us/powershell/scripting/setup/...
It's encrypted, except when it isn't, except on Tuesdays when it is.
https://www.reddit.com/r/PowerShell/comments/97oxox/comment/...
"Just an FYI not all psremoting traffic is encrypted when using http. Message encryption is done using the authenticated context which varies based on what auth was actually used.
For example Basic auth has no authenticated context in SSPI so has no encryption.
NTLM (fallback if kerb is not available) is next to useless as it is based on RC4 which is considered broken today.
Kerberos should be using AES if configured correctly but older environment may have older insecure algorithms set up if the config is mismanaged on the domain level.
CredSSP uses the TLS context that is set up in the auth so is similar to using HTTPS.
When using https you not only get a more consistent and secure encryption mechanism on all auth methods. You also get encryption on the whole TCP packet that is sent to the client, whereas http message only encryption encrypts the message body."
And
"My understanding of the issue is that WinRM can do more than just Powershell Remoting (for example there are also Python libraries that run on Linux machines to interface with WinRM which I'm assuming do something different to PS remoting since PS is not native/required on those platforms). So if you are doing ONLY Powershell Remoting you're probably fine with HTTP, but if you're doing anything else then it could be exposed via HTTP WinRM. So HTTPS is still recommended.
tl;dr - All Powershell Remoting is WinRM, not all WinRM traffic is PS Remoting."
https://www.reddit.com/r/sysadmin/comments/5vph9l/winrm_encr...
And
I think lots of people couldn't get a straight answer on this and it came up on the recent MCP Insider AMA.
First 3 minutes of video 2 "it's secure, use it [...] tell 'em Jeffrey Snover told you, go do it".
"Also, for more information on security when remoting read the powershell.org free e-book, Secrets of PowerShell Remoting.*"
https://www.reddit.com/r/PowerShell/comments/34yzgt/comment/...
What surprises me the most is they could've used the existing (also quite over-engineered, but existing nonetheless) MSRPC infrastructure for this, like what psexec does, but chose to use a completely different set of technologies once again.
A lot of their server side products have weird restrictions or integrate with their other products in strange ways. Nothing is standardised, or simple.
For example, I'm in the middle of a project that needs to log audit data from a front-end service. The service isn't that busy, so doesn't really log that much, however the reporting interface only works with System Center. So to build out the reporting infrastructure I need: 2x System Center Service Manager Management Servers, and 2x System Center Service Manager Data Warehouse Servers, and 2x SQL Servers in a live-sync arrangement. That's six servers, three in each Datacenter. Four of which need 16Gb of RAM. The Management Servers do hardly any work, but due to an artificial restriction placed in the installer, you cannot install them on the same boxes as the Data Warehouse component. Even if you could, MS wouldn't support it.
All this to log no more than 100-200 events a day. To do the reporting any other way, is unsupported. It's nuts. I am starting to believe that Microsoft are now deliberately making their products so complex and so expensive to build on premises, in order to push customers into their Cloud platforms instead. This is certainly true of Exchange Server which is now an absolute nightmare to manage on premises. It's a mail server, why is it so complex?!
To be honest, it wouldn't surprise me if even internal Microsoft product designers and engineers no longer understand how most of the Microsoft server products even work or integrate.
And I say all this as someone who's spent 25 years working with Microsoft products as my day job.
Osh (Object shell) is a command-line utility for running sequences of operations connected by a pipe-like construct. Objects are piped, not strings. Included in the sequence of operations may be remote sequences of command, which run on all nodes of a cluster. For example, if you have configured a cluster named foo, then you can get the pid and commandline of every node of your cluster like this:
osh @foo [ ps ^ f 'p: (p.pid, p.commandline)' ] $
- osh: Invokes the interpreter- @foo [ ... ]: Run the bracketed commands on every node of cluster foo.
- ps: The osh ps command, which yields a stream of Process objects.
- ^: The osh pipe symbol
- f: Function application. The function in this case takes a Process p, and returns a tuple containing the process's pid and command line.
- $: Print the contents of the input stream, one per line.
This is a python tool, so the stuff piped between operations are python objects.
The latest release has a package manager for plugins, so hopefully we'll see more support for remote stuff through that route.
PowerShell has some great ideas, but it seems doomed to mostly be a quirk of Windows at this point. I'd really love to see a more modern shell than bash get adoption across the industry.
I've thought about a new version of osh, making it less of a command-line utility, and more of a shell. What do you think would be the main properties of a "more modern shell"? Do you think it is OK if this shell drags in a Python interpreter?
I enabled ps-remoting, wrote a bunch of scripts, and turned this process into an automated batch job that took 3 minutes.
One of those odd jobs that was a lot of fun.
Does anyone have any use cases where PS Remoting would be more useful?
A bit clunky to set up but it works. I'd rather use SSH than WinRM though, which should be possible in the future now that MS has added SSH support to Windows.
Why do they insist on making the text hard to read?