Earlier quoted context omitted.
Ok, that sounds good. But what if some developer decided that some field would have prefix "ABC" in all values, then the value I am interested in, then some value I am not interested in at the end? (you say this can't happen? Clue: WMI.) Can I take the value, convert it to string, make some magic on it and convert it to another object entirely? I don't know, I never had any problems with text parsing. I love strong t…
There are many ways to accomplish this (in general). My favorite is that you can create 'computed' properties on the fly which means you can continue to keep the strongly typed object in the pipeline, and still have access to the data you care about. https://technet.microsoft.com/en-us/library/ff730948.aspx You use the exact same functions (first, last, substring, replace, etc) as you would normally. Then the rest of…
PowerShell is open sourced and is available on Linux
541–550 of 790 posts
Re: PowerShell is open sourced and is available on Linux
#542Powershell is the first language where I managed to save time by writing a program for a task. Needless to say, I'm thrilled at the prospect of using it on Linux. The only thing that I hope they will need to work on is startup time making sure it performs well on low-spec servers (It can be a bit slow starting cold on older laptops). ls -Recurse | ? { $_.Name -match ".+docx" }
I am not sure what your example does. How does it differ from find . -name " .docx" ls -Recurse | ? { $_.Name -match ".+docx" } And, if these are the same, why type in twice as many characters as a command? Actually, ls -R | grep "\.docx$" is, I think, closer in spirit. Now, the issue is things further in the pipeline, I imagine. The find solution allows selection on type name, type, date, depth, mounts, properties,…
ls -Recurse -Include *.docx
or even this: ls -Recurse *.docx
which is really quite similar your find command.Re: PowerShell is open sourced and is available on Linux
#543Earlier quoted context omitted.
Is this really so useful in practice? I have never used PowerShell before (nor do I have plans to do so in the near future), but I would imagine the downside is complexity, both for user and especially for developers. With text you just read and parse, while with objects you need to know the object type, its fields,... Whatever happend, I hope text stays here (and I have a bad feeling about it ever since I met system…
Could you elaborate on what the actual complexity is, rather than what you imagine? For a developer writing a tool, exposing an interface as objects is far easier than having to constantly serialize data into a string. Keep in mind that once you serialize data into a string, you can never change the order of the data or else other tools will break. Not so with a object based interface. In other system-admin type task…
In summary:
I need to pull data from a company we're partnered with, and get it into our systems. They ship it as SQL Server backup files. OK, no big deal, we can mount those up and run queries to dump stuff out to whatever format we like and ingest it.
Except part of that data is files, which were stored in the DB as binary blobs (in a table along with filenames and metadata). Need to get those out of there and into our storage as real files. OK, no big deal, I can just query for filename and file contents, dump out onto disk and then batch-transfer into our archival storage, right?
Except no matter what kind of obvious shell-idiom method I try to use, it doesn't work because PowerShell stubbornly insists that I must be working with text data when I'm using all those handy shell constructs, and so the files end up corrupt.
So now instead of just being able to shove data through pipes like I would on Unix (which, for all its faults, doesn't really care whether I'm sending binary or text data), I have to have my script go and instantiate objects for creating a file and reading and writing binary streams, and remember to clean up after them, and my script ends up way more complicated.
What would have been a pretty simple script anywhere else now has to know a bunch of .NET libraries and how to create and work with their types, and that's less useful to me.
Re: PowerShell is open sourced and is available on Linux
#544Earlier quoted context omitted.
Yeah, DCOM was a task of fillout the correct fields with the correct values, and try again until you get it right. Anyone with passing C++ knowledge could do it through shear brute force. It's one of the things which made me never want to program on Windows again.
I ported a bunch of COM to Linux in the late 1990's. Not DCOM with the full RPC, but just in-process COM. I had .so shared libs with DllMain and DllCanUnload now in them, I had CoCreateClass, I had a significant part of the registry API implemented in terms of a text file store (HKEY_LOCAL_USER being in the home directory, HKEY_LOCAL_MACHINE somewhere in /etc, ...) and such. IUnknown, QueryInterface, AddRef, Release,…
Re: PowerShell is open sourced and is available on Linux
#545is this really the best of all possible worlds? I think that its good that the shells get some new competition in the form of PowerShell - maybe some new ideas will come out of it (maybe like passing s-expressions or json around the pipe - something more structured so that we could do with fewer command line options - maybe)
doing structured data 'right' is difficult (right meaning uniform and expressive ways of handling it); historically it was easier to stick with unstructured text - but maybe there is a better way that would be easier to learn and handle.
(Well a major problem of structured data is that there are many possible ways of structuring - leading to more problems for the consumer of the data; maybe it was not adopted in system administration because there is not common/agreed upon culture of how to structure things).
Re: PowerShell is open sourced and is available on Linux
#546Earlier quoted context omitted.
> if I can't apt-get it, I'm not interested, It was released just now, under MIT license. Give it a little time and it'll show up.
Or even more! It will need to be backported to Trusty Tahr if one wants to apt-get it on Windows (subsystem for Linux) ;-)
Re: PowerShell is open sourced and is available on Linux
#547Wow. I've been very impressed with Microsoft lately. They could have easily set themselves up as the next IBM, in the sense of being a monolithic corporation relying on corporate practices, but they've been spewing some crazy fun things that shows they're not out of the league yet. Might just be MY miscontrued perception that microsoft was becoming old/monolithic, but really excited with the direction they are headin…
I speak only for myself. Microsoft have been hugely focused on hiring people who have experience outside the Windows bubble, and have been encouraging cross-pollination of ideas with the OSS world. There are holdouts for the old guard of course (there's still a BU that requires Windows Phones), but I think everyone knows that the Microsoft of old cannot compete today by bringing an attitude that pleasing the CFO is a…
Re: PowerShell is open sourced and is available on Linux
#548Earlier quoted context omitted.
I think it might have rolled out already. Turn on Developer Mode in Windows 10 Anniversary Edition, and ssh to port 22 with a valid l/p? Doesn't look like you even need to install WSL.
It looks like they're a little different for now. See the note under here. https://msdn.microsoft.com/en-us/windows/uwp/get-started/ena... Full Disclosure: I am a MSFT employee.
Nope, but it is the same SSH implementation that was in one of the Windows 10 for Raspberry Pi images!
Re: PowerShell is open sourced and is available on Linux
#549Powershell is a horrible abortion, what the hell do people see in it? I mean that on a language level, I cant speak for Windows specific features. I have once written a simple script to copy a folder recursively to a fileshare, rename some stuff, edit some files. Took me 4-5 hours. I then did it with julia in 30 minutes and I never did anything in either language before that. It's insane the kind of weird language cr…
I wouldn't go so far as to call it a "horrible abortion" - but it can be painful to use at times. I manage several Azure environments with PowerShell and not a day goes by that I don't wish there was something better. Especially on those days when I have to dig into Azure's JSON templates. There is an SDK for Python, but I haven't had an opportunity to try it. If anyone has used it I would love to hear about your exp…
That said, I've noticed that powershell seems to get priority with Azure support before the azure-Cli client, so there are a few gaps here and there. I've been told that the Azure REST APIs are all in step with Powershell support, but sometimes go in documented unfortunately.
Re: PowerShell is open sourced and is available on Linux
#550Earlier quoted context omitted.
Nah, why should they? Developers are pretty much the only demographic that might realistically switch operating systems, so they only really need to cater to them. The rest, they can pretty much treat however they want, and they won't lose them as customers.
Exactly. The developers they can get to work for them are "useful idiots", whose work they then use to further screw over their main customers, who aren't going to abandon them no matter what, and also bring in more developers to their platform and away from the competition. As long as these developers are easily and naively wooed by a bunch of BS talk about "the new Microsoft", they get to help MS with their evil sh…
Seriously?
MS is not a monolith, it's made up of lots of different people with different ideologies and different goals.