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:
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 […]
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 […]
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 […]
[UPDATE 2014-04-08] Thanks to Meir I updated the post as the code was missing the definition for the regular expression. Now I corrected that, so the code should work now. In addition, I found out that the apple web server is not serving ‘Set-Cookie’ header according to RFC so I changed the example from apple.com to google.ch (as we are […]
I recently had the need to automatically retrieve and process emails. As I am using Office365 what could have been closer than trying to retrieve the emails via PowerShell and EWS. What I was not aware of is that the supplied Cmdlets that come with the “MSOnlineExtended” module only really deal with account and administration. And the Cmdlet in the […]
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 […]
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 […]
When trying to define a RepitionInterval on a schedule job of less than one minute you receive the following error message: However, there is a workaround on this: you define additional triggers that fire every minute and have them start eg. every 15 seconds: There is a maximum of 48 triggers you can define for any one PowerShell scheduled job […]
When using scheduled jobs in PowerShell v3 you can pass parameters to the scheduled job via the “ArgumentList” parameter. However, you can only pass values via its position (instead via its name) as the parameter expects an array of objects: So it is not possible to run any of your scripts as “scheduled jobs” when they expect only names parameters. […]
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 […]
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 […]
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 […]
Using PowerCLI for fun and profit in general is a great thing to do – in general… However, in certain cases PowerCLIs implementation is much slower than using the underlying REST calls directly. This is especially true when using Get-CiVm to get information about a vCloud Director (vCD) virtual machine. Consider the following fragment: This is all pretty fast, as […]
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 […]
Today I want to share a funny experience we had with a clean vCO 5.1 install … Having a freshly installed vCenter 5.1 with an integrated installation of vCO upon first startup the vCO Service did not start and took (15!) minutes to finally reach a state where it was between starting and stopping. The log files included lots of […]