Skip to content

Category: Technology

Anything related to technology

PowerShell 0

CTERA Code Snipplets

Here are some code fragments that might help when dealing with CTERA REST responses. For a complete PowerShell module check this post Module: biz.dfch.PS.Storebox.Api. 1. Selecting an Attribute value based on its ‘id’: 2. Converting a list ov ‘val’ into an array 3. Loading XML template from ‘defaults’ and populate them:

PowerShell 0

[System.Net.WebClient] does not return data properly

When using the System.Net.WebClient class you are actually using a class that wraps WebRequesr and WebResponse with some benefits as abstracting stream and handling logic. However, this, comes at a price and sometimes along with some errors, too. When a web server responds with an HTTP 500 Status the WebClient throws an exception and you do not have  access to […]

PowerShell 0

Using DeathByCapture from PowerShell

DeathByCapture provides a .NET assembly for interaction with the mighty workforce overseas that lets you overcome those nasty captchas. Unfortunately you cannot use the assembly when you want to ‘[System.Reflection.Assembly]::LoadFile()’ as the ‘DeathByCaptcha.HttpClient’ is an abstract base class where you cannot pass the login credentials as arguments to the constructor. Adding the assembly to the GAC is not possible without […]

PowerShell 0

Invoke-WebRequest uses id attribute of input element as field name in form fields collection

As already described on elsewhere on the Internet and on Microsoft Connect, the new Invoke-WebRequest Cmdlet, that comes with PowerShell v3, handles form fields incorrectly. Instead of referring to the name attributes of input elements within a form the Fields Collection stores the ids of the attributes under the ‘key’ property. As in the following example you see the text […]

PowerShell 0

Communication with Apple iTunes Store and WebSite

Recently I had the task to automate a few things regarding AppleIDs. One of things was to create, change and verify AppleIDs. Having no tools (apart from Apples inofficial buggy AppleScript screen-click-automation scripts) I had a look at the HTTP communication between iTunes/the web client and the iTunes Store and AppleID servers. The login to AppleID is rather straightforward by […]

PowerShell 0

Creating a WebClient Request from an HTTP payload

The other day I was using Fiddler to examine some web traffic to automate some tasks. I then stumbled upon a cool Fiddler extension called Request to Code (by Chad Sowald), which takes any HTTP(s) request and converts it to C# code using the System.Net.WebRequest and System.Net.WebResponse classes. Unfortunately, the extension does not support PowerShell. As I am using the […]

PowerShell 1

[Array] becomes [ArrayList] when imported via Import-CliXml

Serialising and Deserialising data structures is pretty easy when using Export-CliXml/Import-CliXml. However, there are some gotchas. In addition to the already described bug when using [ordered] hashtable in PowerShell v3 with Import-CliXml there is another error when importing [Array] with Import-CliXml: an [Array] becomes an [ArrayList]. The following code shows the problem: Again, this error seems to occur when you do […]

Various Products 0

vCloud Director (vCD) allocates DistributedVirtualPorts from a DistributedVirtualPortGroup in a non-sequential order

When you have a DistributedVirtualPortGroup in vCenter (vC) with a fixed number of VirtualPorts of 10 and you set that DistributedVirtualPortGroup to “non-expanding” you will get an error with vCloud Director (vCD) when you try to allocate more than one (1) DistributedVirtualPort. However, when you look at the DVS DistributedVirtualPortGroup you find enough available DVS DistributedVirtualPort displayed. The error message […]

vCloud Automation Center 0

Cannot create blueprint in vCenter Automation Center (vCAC) 5.1 when you have no networks defined

When you try to add a “Global Blueprint” in vCenter Automation Center (vCAC) 5.1 for an Organisation VCD (OvDC) in a vCloud Director (vCD) endpoint you cannot save your settings if you have no Organisation Networks (OrgNetwork) defined. As the selection of a network (and a storage path) is mandatory input and the selection list for the networks is empty you […]

PowerShell 0

PowerCLI Search-Cloud reports wrong data on QueryType ‘ProviderVdc’

Recently I quickly mentioned the universal PowerCLI applet Search-Cloud that can be used when dealing with vCloud Director. Howevery it seems you have to verify its output when using it to query Provider Vdc parameters. The output mixes the “allocation” and “used” counters for CPU, Memory and Storage as you can see in the example below (“used” is larger than […]