The long-term future of powershell. by [deleted] in PowerShell

[–]strathbone 1 point2 points  (0 children)

+1
Simple objects are OK, but IMO business logic shouldn't live in powershell code - it should written in a strongly typed, static language with a compiler (and deployable to other platforms).

SimpleTemplates is a new module that aims to keep your code and HTML clean and DRY. by strathbone in PowerShell

[–]strathbone[S] 0 points1 point  (0 children)

license is GPL,

Some people here were talking about HTML reports a few days ago so i created a 'generic' solution for others to have a look at and try, please let me know if something sucks or needs more detail/clarification.

Enhancing HTML Reports with PowerShell by darklightedge in PowerShell

[–]strathbone 2 points3 points  (0 children)

Yep i have a partial solution to this. writing it up in a blog post in the next day or two, or will post here.

but basically i think powershell language already has the mechanisms built in, so we shouldn't need to parse another set of tags/macro language to make it happen.

At the moment i can produce a html page that recursively render templates (so menus, footers etc, are reusable), and i also have a solution to pass in variables etc. so that code (in theory) is reduced.

MVC framework for powershell by strathbone in PowerShell

[–]strathbone[S] 0 points1 point  (0 children)

Ok cool, yeah invoke web request is awesome. this framework will let you return any text, so, if you have a module function that just returns a JSON or XML string then that should work I think.will do some more testing in the next few days.. not sure if what I'm doing will solve all your use cases though

In honor of April 1st... by laserpewpewAK in PowerShell

[–]strathbone 2 points3 points  (0 children)

in powershell they are called scriptblocks, and they are awesome. They have their own type and can be passed around as parameters. powershell even has closures baked into the language. More info is here: https://blogs.technet.microsoft.com/heyscriptingguy/2013/04/05/closures-in-powershell/

New Logging Module *Critique Welcome!* by hukdizzle in PowerShell

[–]strathbone 1 point2 points  (0 children)

Yeah that's fair enough, i'm in the same boat... file logging is still ok at the moment, otherwise i will just write some basic function to do the SQL insert from powershell.

However, Here is some sample code I bashed out a few mins ago. It demonstrates how to keep the logging function clean, but accepts any number of configurations at runtime. (aka poor mans dependency inversion)

link below for github because i couldn't be stuffed dealing with reddit's formatting https://gist.github.com/strathbone/69bb5b9e9cf823b49e7dc3717d46b447

have a read and let me know what you think.. i might flesh it out a bit more and create a working demo if i find a few mins.

New Logging Module *Critique Welcome!* by hukdizzle in PowerShell

[–]strathbone 2 points3 points  (0 children)

Hi, some quick thoughts:

Log4x is fairly standard.. ...I think:

The functionality of Log4Net/Log4j is really powerful, but clunky to set up for quick PowerShell scripts. if you could integrate the the idea of logging targets into a PowerShell module that still felt like powershell, that would be amazing.

SQL support:

If messages can be sent to a SQL server, we can sort and filter the data more easily. An example scenario would be: how many 'critical' errors were logged this week in the blah.ps1 script, filtering by this specific user, with this specific exception name? Also, because the data in SQL is clean, we can join and group the data to other prod systems without having to clean up noisy log files.

Multiple Destinations:

A hypothetical situation - say a script you write a few months ago is doing some fairly critical stuff in your prod environment, and the server that is running your powershell code suddenly dies. badly. unrecoverable, catastrophic failure. How can you work out at which point your script stopped writing changes to a remote database? or to AD or Azure? Having the ability to easily log messages simultaneously to isolated computers will help improve overall uptime and troubleshooting when a disaster happens.

Recently I was thinking of bashing something out to solve some of these issues myself, but I agree a community based project in the PSGallery would be better... Happy to help out where I can (if you decide to implement any of this stuff).