Skip to main content

Posts

Showing posts with the label V4

Powershell – Get-EvntLog

Today we are doing 2 things, or actually 3 things: Building a custom Get-EvntLog function built upon the standard Get-WinEvent cmdlet Using DefaultDisplayProperties Using an embedded function in an function (why, because why not, we can?) Main reasons for doing this: Bug in .net and/or Get-WinEvent for any other culture than en-us (I use no-nb), The message property is returned as $null if I use Get-WinEvent Speed – Get-Eventlog is fine, however I want speed like we get with Get-WinEvent I can work around the bug in Get-WinEvent by temporarily switching to the culture en-us. When I have used Get-WinEvent and processed the results, I reset the culture to the original state. No harm done. A few words about the custom object function (Create-CustomObject). It takes 2 parameters; Properties ([string[]]) and DefaultDisplayProps([string[]]). At the end it spits out a new object (PSobject) with the DefaultDisplayPropertySet’ configured. To demonstrate: Okay, so ...

Desired State Configuration with Powershell

At TechEd North America 2013 Microsoft has shed some light on the upcoming release of Powershell Version 4. The big news is the DSC or Desired State Configuration feature. Though I should just make a few comments about it. What is it? With DSC you can apply a configuration to your servers/datacenter i matter of minutes from powershell. DSC does not have any dependencies of the underlying infrastructure, however it is a tool to configure it. The scope of the DSC can be a server, a collection of servers or other infrastructure items. How is it delivered? DSC support both PUSH and PULL configurations. You can apply an configuration with a script that targets specific objects (PUSH) or you can provide an URI to the configuration and the scoped selection and the targets will download the configuration from there (PULL) at scheduled intervals which also can be configured. If you use a PULL model, you must configure your target nodes with an URI and an UU...