5 ms·
That's just not true. It feels true to Unix admins trying to do Unix things on Windows and getting frustrated when nothing feels familiar. Let me quote the art
by jiggawatts 4y ago
That's just not true. It feels true to Unix admins trying to do Unix things on Windows and getting frustrated when nothing feels familiar.
Let me quote the article directly: "no SSH"
WinRM is roughly equivalent and superior in many ways. E.g.: It takes quite the effort to produce a report of "some setting or flag" across a fleet of servers with SSH, Bash, Sed, Awk, etc..
Now try this with PowerShell:
Invoke-Command -ComputerName $varWithListOfServers { Get-Process 'ubiserver.exe' } | Export-Csv 'report.csv'
This will connect in parallel to all the servers in the list (could be thousands!), 32 at a time by default. It'll get all of the process info (memory, cpu time, etc...) for a game server, and then add the source server computer name as an extra column. Dumping this to a valid CSV is a no-brainer.
Put this in a scheduled task and you've got something Excel or Power BI or whatever can pick up and chart, graph, or send to a manager.
Try this with Linux. Seriously. Sit down and do the equivalent: many servers in parallel, batched to prevent overload, server name as an extra column, valid CSV output with proper quoting of quote characters, etc...
Oh, did you notice the lack of authentication rigmarole? The whole thing is secured and encrypted via Kerberos automatically. Copy the equivalent of that too. (Assume you have 10K servers that you haven't manually added the SSH keys of into your local workstation config.)
Put the script in the reply.
PS: I know some Unix people think that brevity is more important than time-to-solution, so to head off that whole argument:
PS C:\> Get-Alias | ? ResolvedCommandName -in ( 'Invoke-Command', 'Get-Process', 'Export-Csv' )
CommandType Name
----------- ----
Alias epcsv -> Export-Csv
Alias gps -> Get-Process
Alias icm -> Invoke-Command
Alias ps -> Get-Process
Ta-da, now it's just as unreadable as Unix:
icm -CN $s { ps 'ubiserver.exe' } | epcsv 'report.csv'
- hnlmorg 4y ago> Try this with Linux. Seriously. Sit down and do the equivalent: many servers in parallel On my phone so not going to type the full command line out ostensibly it would be: xargs ssh ‘ps process-name’ I’d need to pull the man pages up to double check which flags you’ve specifically requested. But the above is the general gist of it. —— I think it’s pointless to compare such granular features side by side though. For every microscopic thing Windows better Linux will have others it does better too. And visa versa. It’s the overall administration at a higher level I’m more interested in: How long does it take to go from a new requirement to a deployed service? How easy is it to automate? To adapt? To scale? To fix? Or even forget fixing entirely and just run as a fleet of ephemeral instances. Windows can and does support everything Linux does too. But Linux is just generally easier to work with (in my 30 years of experience managing both). I wouldn’t say Linux is the peak of UNIX-like systems either though. But that’s a whole other argument for another day :)
- jiggawatts 4y ago> But the above is the general gist of it. It's not even remotely the gist of it. The output of that is formatted (pretty-printed) text, not CSV. You won't know which computer the output came from. You can't use this output in any meaningful way. It's not useful to the business. ssh can't connect to multiple servers at once (other tools like multissh can). However, most such tools aren't designed for and aren't capable of scaling up to a thousand or more servers. Windows PowerShell and WinRM can, yet people like you just blindly dismiss it, assuming that it "must" be worse than Unix/Linux, since everyone knows that Windows doesn't even have a shell! To quote the original article: "there was nothing to lean back on: no shell" Windows has a shell, the author of the article just wasn't aware of its existence, let alone its comparative feature set.
- dijit 4y agoI'm well aware of the existence of powershell and CMD, such things are not a real luxury when you're limited to whatever Windows provides you with as utilities as opposed to the astonishingly wide plethora of commandline utilities available else where (where everything is a file and is easy to read, parse, filter, save-). Windows 2012r2 came with Powershell 4.0, which I'm sure you'll agree was limited in ways that bash is not, since bash is a collection of utilities and doesn't require deep integration with the platform to function. For example in your example above you use 'Export-Csv', but that was introduced in Powershell 7.0 Am I saying that it's not possible? Not really, powershell can probably do everything I need it to, but it's not as simple as `ssh user@host` and I'm talking in a way that feels native to the system. It requires a paradigm shift in thinking that most of our developers didn't embrace and discoverability is just lower there anyway. Claiming that winrm is better than SSH is... just the most absurd thing I've heard this year. The main reason that I got annoyed with Windows though is not the eggregious license cost- it wasn't that it used an enormous amount of resources- the documentation was really nice! It was that my iteration times on toying with things went from 5 minutes to 25 minutes in the minimum, that doing any kind of exploratory work meant near certainty that I'd be RDP'ing. This is not a "I hate windows" rant, but the defensive position you have taken here is frankly unpaletable. Windows has it's strengths, and perhaps I am not the person to charter a course to a fantastically well designed "Windows-centric" solution to problems -- but fuck, it worked honestly and it worked better than any of the Windows admins in Ubi could have mustered. Maybe that's a statement about the general competence of windows admins or just the ones at Ubi, I don't really know. But Windows is a poor fit for dynamic server workloads such as those. The only reason it was chosen was because the game was developed on Windows and against Windows APIs - some of which were even better than Linux ones at the time, like IOCompletionPorts, which I have extolled virtues upon - rewriting the software to work on Linux would have been a hugely time intensive process. That decision cost Ubisoft literally millions of euroes and was a decision that was later reversed- after I left. So I am not the blame for that.
- sshagent 4y agoI'm sorry, but this comes across as exactly the same kind of bias as the author. "my knowledge of windows sysadmin methods means Unix methods are crap". I'm afraid it's horses for courses, it's always been. We'll all pick our own preferences of course,but let's not assume total superiority over "them".
- olavgg 4y agoThe big problem with Powershell vs Unix is lack of documentation. Seriously, everything takes 100x less time to figure out on a Unix platform than Powershell. And my life is to short for that.
- jiggawatts 4y agoIt has hundreds of pages of clear documentation, video training, you name it. https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/00-introduction https://learn.microsoft.com/en-us/powershell/scripting/learn... https://learn.microsoft.com/en-us/training/paths/get-started-windows-powershell/ https://learn.microsoft.com/en-us/training/paths/get-started... It is also far more discoverable than any other shell I've ever used. Install PowerShell 7 on Linux now. e.g.: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux https://learn.microsoft.com/en-us/powershell/scripting/insta... Now try some of these commands. Can you guess what they do? Get-Command Export-* dir | Get-Member Last* Get-Help Sort-Object -Full dir | Sort-Object LastWriteTime -Desc | Export-Csv 'files.csv'
- vips7L 4y agoPowershell docs are literally built in… help <command> That being said powershell is much more discoverable _for me_ because it’s simple objects that get piped. I don’t have to figure out how to parse the text of a traditional shell. I can just get things done.
- jjgreen 4y agoHorrific, were they on drugs when they designed that?
- aae42 4y agoWinrm is nowhere near equivalent to SSH. It's terrible. Just try using anything that uses window's DPAPI over winrm. You have no such limitations with SSH. Also it's authentication mechanisms are vastly superior (SSH key pairs).
- rakoo 4y agocat list_of_servers | parallel --tag ssh {} ps -aux The whole point of UNIX is to use independent, composable tools that speak the same interface. If the interface is space-separated values, use space-separated values. If Excel or PowerBI don't use that then don't use Excel or PowerBI.
- jiggawatts 4y agoYour boss uses Excel and doesn't like it when the reports\ read\ like\ this because you ignored his requirements. Your coworker is also angry at you now, because when he scheduled your script to run regularly, the output occasionally turns into gibberish because of inconsistent handling of special characters and error conditions, breaking automations randomly. I spotted several errors in your provided "solution", which ought not be possible, because I'm a person that uses Linux briefly every few years. The problem statement isn't a made up, artificial, or toy scenario. The few times I have to use Linux, it's to do this kind of activity. "Run a command on all Linux servers in the data centre" is something I had to do just recently, and it turned into a multi-month exercise involving six people. It would have been an hour with Windows. Think "look for log4j", "install an agent", or "report on the kernel version used". Problems like this seem trivial, but it is precisely the independent nature of those tools that makes them not composable. For example, 'ps' has different output and different capabilities on different systems! You can't naively run it across multiple systems, because output will be an inconsistent mess. You can't then sort, filter, aggregate, or do anything useful with its output. "aux" is the wrong option to use. It'll pretty-print the output, which forces it to truncate long values. It'll return date times with inconsistent offsets, depending on each server's individual time zone and regional settings. It'll strip the year off, so if you want the 'date' a process started, it won't be obvious if it has been running for 1 month or 13 months. If any servers aren't already in your ssh keychain, then your command will... what? Freeze? Output errors into the report? Prompt for your input thousands of times, one per server? In parallel? How... did you expect this to work!?
- minusf 4y agosaying your thousands of servers wont have ssh keys installed when they have arbitrary software installed is disingenuous at best. thousands of servers are managable only with orchestration solutions, this is a solved problem. the unix world also has evolved from a bash for loop to ssh into servers and read outputs. i can solve your task in comparable time with pyinfra or ansible executing arbitrary python code on every node with not just csv output but whatever you dream up.
- minusf 4y agoi am happy for your tool and productivity. but where was powershell (introduced in 2006) on unix (introduced in 2016) when admins needed it since epoch? the tools i have learnt might have more cryptic names but they were there since the beginning. it took microsoft an awfully long time to realize cmd.exe just wont cut it. also powershell has no choice but to include the kitchen sink to be usable because there is little composability in the windows shell world compared to the cambrian explosion of unix utilities. anyway, each to their own, peace.