• Jaloopa (unregistered)

    This is what happens when you try to use Powershell for something that's clearly more suited to CMD

  • Kattman (unregistered)

    Thanks I been looking for these codes for a while. I'll copy them to my own processes.

  • Tom (unregistered)

    The real WTF is that PowerShell commands manipulate objects, so formatting the output (which is an array of objects) to a string and then parse it, is useless and counter-productive

  • Jim Tonic (unregistered)

    With SharePoint, the ugly was is often the only way. This is probably a gem, in the eyes of a SharePoint developer.

  • P (unregistered)

    The real problem to fix is how this code got submitted to TDWTF in the first place.

  • Shut the fuck up (unregistered) in reply to P

    Shut the fuck up

  • sizer99 (google)

    I think you already mostly described how this got written in the first place: Cow-orker didn't know how to do it, so googled, found some stuff on stackexchange (or maybe expert-sexchange), then crammed it all together till it works. This is what you get - especially the inappropriate variable names because he doesn't really understand what's going in.

    It's like any Indian outsourcing result, except the 'till it works' rather than 'till it compiles' bit.

  • (nodebb) in reply to sizer99
    except the 'till it works' rather than 'till it compiles' bit
    Which you have to admit is rather a significant improvement
  • James (unregistered) in reply to sizer99

    A broken clock is right twice a day. Just because they call it a day after it compiles doesn't necessarily mean it won't work.

    Nitpick: Until abbreviates to 'til.

  • (nodebb)

    SPEnterpriseSearchCrawContentSource? That sticks in my craw!

  • P. Wolff (unregistered) in reply to cellocgw
    except the 'till it works' rather than 'till it compiles' bit
    Which you have to admit is rather a significant improvement
    "Compiles" can mean several things. E. g. it throws an exception right on startup, produces any output at all, produces some output that looks correct, or produces some output that looks enterprisey.

    ("some output that is actually correct" is a High Fantasy novel term.)

  • jeff jefferson (unregistered) in reply to James

    https://www.merriam-webster.com/dictionary/till

  • WTFguy (unregistered)

    I'm a longtime SharePoint guy who lived and worked through the advent of Powershell.

    Pre-Powershell there were lots of SharePoint admin tasks that could be done (painfully) using the older CMD-based command line admin app(s) that produced only text output. The early days of Powershell and the SharePoint admin tooling to run under it were very, very poorly documented. And equally poorly understood. Which led to lots of folks using the new tools in the old way.

    For whatever reason, SharePoint for both devs & IT admin has long been a cesspool of people who just barely know enough to do their jobs badly. Really grokking how to do things the right way and get the benefits the platform promised (and really is capable of) was/is pretty rare. So cargo-cult cut-and-paste is largely the only coin of the SharePoint realm. And that was before we even start talking about the widespread 3rd-world outsourcing that quickly followed SharePoint's rise in popularity with the enterprise crowd.

    In many ways Microsoft's huge direction change with the 2013 & subsequent versions was/is an acknowledgement that they released something that the bulk of their customers simply lack the technical skills or capacity to use well. So ever since they've been steering everyone towards cloudy installations mostly managed by MSFT and using disconnected service-oriented client-side APIs so the devs' bad code can't crash the server infrastructure.

    It's a huge exercise in moving their customers into a sandbox safe enough to contain their incompetence.

  • xtal256 (unregistered)

    "Look, bash is ugly, but somehow, PowerShell manages to be even more ugly. It's almost impressive."

    But in this case, the author is writing PowerShell in a bash-like way (treating everything as strings and doing string manipulation). If they were using PowerShell properly, they'd realise that the result of Get-SPEnterpriseSearchCrawlContentSource is an object, and they can just access the fields directly rather than formatting it in a table (using "ft"). I'd like to see bash do that!

Leave a comment on “Sharing the Power”

Log In or post as a guest

Replying to comment #:

« Return to Article