Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation
by Arnavion on Monday January 22, 2018 @04:53PM
(#16208294)
>Very few basic functions have been implemented in powershell
>nslookup
[System.Net.Dns]::GetHostAddresses('google.com') | % ToString
>In addition some powershell commands managed to be inferior to their batch equivalent. Setting a registry key is a prime example. ... it takes several commands in powershell for something that is done in one command with reg.exe. sp 'HKLM:\path\to\key' name 'value'
Re:Microsoft’s PowerShell Core Offers Cross-Platform Automation
by cm2187 on Monday January 22, 2018 @05:03PM
(#16208381)
On nslookup, my point is that it shouldn't crash a powershell script. It's a valid windows command.
On the registry, your command will fail if HKLM:\path\to\key doesn't exist whereas reg.exe would create the key automatically
A few examples of the absurd things I found along the way:
It is impossible to update windows remotely with powershell. The only API to windows update is apparently a COM interface that refuses to be called remotely. I found a hack on a forum where I have to create a scheduled task that runs as a local admin user and trigger that task remotely. This is farcical.
The equivalent of ssh is something called powershell remoting. Of course opening that interface is a significant security risk that need to be monitored. However windows events records all failed authentication attempts on powershell remoting as a local connection and therefore does not expose the IP of the attacker. So much for monitoring.
Very few basic functions have been implemented in powershell, half of my powershell script is actually made of traditional batch commands, with all sort of random behaviors (like nslookup makes the script fail), inconsistent API, etc. It feels like using Windows 10 where we are stuck with half of our settings in an old control panel and the other half in a new one, feels sort of half baked. In addition some powershell commands managed to be inferior to their batch equivalent. Setting a registry key is a prime example (and god knows it is a common task), it takes several commands in powershell for something that is done in one command with reg.exe.
Of course there is no way to run a ps1 with admin privileges directly from the windows shell [1]
etc.
[1] winaero has a hack to do that: https://winaero.com/blog/run-as-administrator-context-menu-f... But come on Microsoft, don't you use your own product?