Skip to content

Category: PowerShell

Windows PowerShell

PowerShell 1

Decrypting Passwords in vCAC ConnectionCredentials

Suppose you provision a virtual machine to a vCenter and then want to change the socket/core ratio of that machine as described in vCloud Automation Center – vCAC – Workflow and Script to Change CPU’s to Cores. For this to actually work you not only need the vCenter address but also some valid credentials you can use to connect to […]

PowerShell 0

Resolve and Determine vCAC Machine Type

Here is a way how to quickly determine the machine type to be deployed without resorting to the ‘VirtualMachineExt’ object (which by the way is not yet available in the ‘BuildingMachine’ state): In case you wonder what other machine types exist you can check the enumeration like this: Though this can easily be achieved in a different manner, the point […]

PowerShell 0

Setting XML namespaces in XmlTextWriter correctly

Using [System.Xml.XmlTextWriter] in combination with [System.IO.StringWriter] you can easily create an arbitrary large XML document in memory on the fly. Creating and closing elements and attributes comes down to a simple pair of WriteStartelement()/WriteEndelement() and WriteAttributeString(). However when you want to create namespaces in your XML document things get a little bit trickier as the accompanying MSDN documentation for WriteAttributeString() […]

PowerShell 0

vCO PowerShell Plugin: Import-CliXml fails with System.Security.Cryptography.CryptographicException

When using the PowerShell plugin for vCenter Orchestrator (vCO) you might receive a ‘System.Security.Cryptography.CryptographicException’ exception when using ‘Import-CliXml’ with a PSCredential object. Furthermore, you might get the message: ‘The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation’. The reason behind this seems that the security […]

PowerShell 0

Programmatic way to get valid values for a Cmdlet parameter

Recently I needed a programmatic way to check valid arguments for a Cmdlet that were defined by a “ValidateSet”. I came across the article from Jeffrey Snover “Programmatic way to get valid string values for a parameter” but the mechanism did not seem to work (unless you start PowerShell with the “-Version 1” or “-Version 2” parameter). As this article […]

PowerShell 0

[System.Net.ServicePointManager]::CheckCertificateRevocationList not working when using Invoke-Command or New-PSSession

When you use a Invoke-Command or New-PSSession Cmdlet you might run into an error stating that the Certificate recovation list could not be checked. When you set the corresponding property – you still get the same error message. This is because the aforementioned Cmdlets do not honour this setting (whereas they honour to bypass all certificate validation). Instead they implement […]

PowerShell 0

Search-OSCEXOEmailMessage does not handle PageSize and Paging correctly

Another bug in the OSCEXO module… When searching for mails within a mailbox well known folder with more than “PageSize” messages the cmdlet Search-OSCEXOEmailMessage never return and keeps “searching” forever (or until you run out of memory – whatever happens first). The reason behind this is that the code that handles the “ExchangeService.FindItems()” calls does not increase the PageOffset and […]

PowerShell 1

PowerShell New-WebServiceProxy fails to instantiate Clickatell SOAP WebService

When trying to use the Clickatell SOAP WebService via “http://api.clickatell.com/soap/webservice.php?WSDL” you receive a “FileNotFoundException” exception: You effectively have to use the workaround described in the manual by calling the web service under this address: ‘http://api.clickatell.com/soap/webservice_vs.php?WSDL’. The reason behind it seems to be use of a conflicting attribute named ‘callback’.

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: