Skip to content

Tag: NoBrainer

PowerShell 1

[NoBrainer] Using ODATA Actions via PowerShell

Have you ever tried to use ODATA Actions from PowerShell and realized that the Service Reference in your class library does not expose them? You can actually do it via the model’s ‘Execute()’ method. Here is a quick description on how to do it without writing too much URL style code. Let’s presume we have a model referenced in a […]

LightSwitch 3

[NoBrainer] Saving bandwidth with JSON when consuming ODATA services from PowerShell

When working with ODATA sources from PowerShell via a service reference (instead of using explicit REST call via Invoke-RestMethod) the .NET DataServiceClient will use Atom/XML under the hood. This works perfectly well except it consumes much more bandwidth because of the XML data format. As the whole ODATA interface is encapsulated via your service reference it really does not make […]

LightSwitch 2

[NoBrainer] Using JayData with jQuery select2 plugin in LightSwitch HTML

In this post I quickly describe how you can use the select2 plugin with LightSwitch HTML client and present data from ODATA sources via jaydata. LightSwitch has builtin capabilities for selecting related entities via the ‘Modal Data Picker’ control. You can also have drop down or choice lists with static data, however they lack the convenient search and filter mechanisms […]

PowerShell 0

[NoBrainer] PowerShell fails to Add-Type an assembly with HRESULT 0x80131515

When you try to add an assembly that you downloaded from a network share or the internet to your PowerShell session via ‘Add-Type -Path C:\folder\your-assembly-name.dll’ you might a receive an error like this: The result itself could give you a hint and querying the inter you will probably others experiencing the same error as described in Visual Studio Project Sample […]

PowerShell 1

[NoBrainer] Convert IP address string into an [IPAddress] compatible constructor string

When you try to convert an ip address string into an [IPAddress] object you might end up with a different address than expected. This can happen if you use the ‘leading zero’ notation for IPv4 addresse (which is not really correct, but easier to sort alphabetically). When you create an [IPAddress] with that kind address style, the constructor does internally […]

PowerShell 2

[NoBrainer] Use splatting to simplify Cmdlet development

When rolling your own Cmdlets you will probably want to expand your module over time possibly adding or editing functions. I order to keep your Cmdlet as a function and not having to reload the module on every code change you can use Splatting (which requires at least PowerShell v3) to simplify developement and debugging. All you have to do […]

PowerShell 6

[NoBrainer] SSL connection error when using PowerShell

When using https request (directly or indirectly) with PowerShell you might run into different errors when using non-standard (i.e. not trusted, expired, self-signed etc) certificates: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The underlying connection was closed: An unexpected error occurred on a send. In either case you will find plenty of […]