SCCM set a custom variable dependency using Powershell or Vbs

When you are a frequent user of SCCM, sooner or later you will want a custom variable on which u can set a dependency for jobs further on in the task sequence.

After searching online for a while and not finding a satisfying answer I decided to create a short how-to.

Read more

Scriptable Citrix Password Encoder

A while ago I published a tool to Encode and Decode Citrix passwords. Today I am publishing a small update to this tool that makes it scriptable by adding a COM interface.

If you start the tool without parameters you will get the GUI, just like before:

Encrypt | Decrypt Password | Hash | Citrix | Ctx1

To use the COM interface you first need to register the executable with the /regserver switch:

CtxPass /RegServer

After the registration you can call it using any language that supports COM. To get you started I wrote a few examples

Read more

MSCOMM32.OCX returns error 80040112

Yesterday I wrote about troubleshooting an application that used Com Port redirection in Citrix.

During the troubleshoot I noticed that the application used an ActiveX component, MSCOMM32.OCX, for serial communication.

I wanted to quickly test if the component was correctly registered so I searched the registry from HKEY_CLASSES_ROOT for mscomm32.ocx.

Read more

Script to Get Computer OU

Just some quick code to get the OU Name of the computer we run the script on.


Function GetComputerOU
	Dim objSysInfo: Set objSysInfo = CreateObject("ADSystemInfo")
	Dim objComputer: Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
	Dim objOU : Set objOU = GetObject(objComputer.Parent)
	GetComputerOU = objOU.OU
End Function

Wscript.Echo GetComputerOU


function GetComputerOU
	$SysInfo = New-Object -ComObject "ADSystemInfo"
	$Computer = [ADSI]("LDAP://{0}" -f $SysInfo.GetType().InvokeMember("ComputerName", [System.Reflection.BindingFlags]::GetProperty, $null, $SysInfo, $null))
	return ([ADSI]$Computer.Parent).OU


Get the location of an advertised shortcut

Installers can create so called Advertised Shortcuts in the Start Menu. I wanted to check the Target Path of such an shortcut but Explorer doesn’t show it:

Microsoft Visio 2010 Properties | Shortcut Properties | Target Path

Read more

VMware ThinApp package crashes with VBS.

For the intergration of VMware ThinApp applications into RES Workspace Manager, a custom VBS is required in the root of the Setup Capture files folder.
The following code must be present in the script:

Function OnFirstParentStart
WaitForProcess ExecuteVirtualProcess(GetEnvironmentVariable(“pwrgrids”)),0
End Function

But some ThinApp applications failed to start after that, or any vbs script was added to the build.

Read more

Citrix online plug-in received a corrupt ICA File

imageI was testing a Script I wrote to launch a Citrix XenApp session using the Ica Client Object. Typical code to do this may look like this:

Const cHttpBrowser = "someurl.local"
Const cColorDepth = 4

' Create the ICA Client Object
Dim objIca : Set objIca = CreateObject("Citrix.IcaClient.2")

' Set Credentials
objIca.Username = "JohnDoe"
objIca.SetProp "ClearPassword", "Secret01"
objIca.Domain = "CONTOSO"

' Connection Settings
objIca.BrowserProtocol = "HTTPonTCP"
objIca.TransportReconnectEnabled = True
objIca.HttpBrowserAddress = cHttpBrowser

' Session Settings
objIca.Address = "MyApp"
objIca.Application = "MyApp"
objIca.DesiredColor = cColorDepth
objIca.ScreenPercent = 0 ' Full Screen
objIca.DesiredHRes = 0
objIca.DesiredVRes = 0
objIca.Launch = True

' Connect

On my testmachine it ran nicely but on a customer machine the script failed with the error 2312 “The Citrix online plug-in received a corrupt ICA File. The ICA File has no [ApplicationServer] section”:

The Citrix online plug-in received a corrupt ICA File. The ICA File has no [ApplicationServer] section

Read more

VBScript vs PowerShell

imageI am converting an old VBScript to PowerShell and it’s very nice to see how many lines of code in VBS can be written in one line of (much better readable) code in PowerShell.

Read more

Apply IP Configuration from a Database

I am currently deploying 64 Citrix XenApp servers with Altiris. The deployment consists of an OS Image, OS Configuration and finally Citrix XenApp and Applications.

In the OS Configuration part the IP configuration needs to be applied and I decided to do this with a database.

The database consists of 2 tables; one table with the per host settings and one table with the global settings (such as DNS).

In the Altiris job both tables are read from an embedded VBScript and assigned to the NIC.

Database configuration

I created a database (SQL Server) called IPManagement with 2 tables:



Read more

Search XML Files

In a  VB Script I am writing I needed to read an XML file and read a GUID from it.
The XML file looks like this (there’s more data in it, I am just displaying a small piece so you can see the structure):


I needed to lookup the value of the GUID Node of the NodeGroup with a specific name. We could do this with a classic for loop, enumerating all nodes, enumerate it’s children etc.

But there’s a much simpler way using a search filter:

Set xmlDoc = CreateObject("Msxml2.DOMDocument")
GuidEven = xmlDoc.selectSingleNode"/dsDASe/NodeGroup[Name='DesktopSiloEven']/GUID").text
GuidOdd  = xmlDoc.selectSingleNode("/dsDASe/NodeGroup[Name='DesktopSiloUneven']/GUID").text

Remko Weijnen