Why does setting the 'QueuingEnabled' of a COM+ app remotely by powershell cause the save to fail?

259 Views Asked by At

I have this powershell script which is creating COM+ applications on a remote machine:

$credentials = Get-Credential -Message "Test" -User "DOMAIN\User"
$roleRM = new-pssession -computername MACHINE -credential $credentials

Invoke-Command -Session $roleRM -scriptblock `
{
$comAdmin = New-Object -ComObject ("COMAdmin.COMAdminCatalog.1")   
$comApplicationCollection = $comAdmin.GetCollection("Applications")
$comApplicationCollection.Populate()
$comApplication = $comApplicationCollection.Add()
$comApplication.Value("Name") = "Server"
$comApplication.Value("ApplicationAccessChecksEnabled") = 0
$comApplication.Value("AccessChecksLevel") = (0)
$comApplication.Value("Authentication") = (1)
$comApplication.Value("Identity") = "DOMAIN\User"
$comApplication.Value("Password") = "password"
$comApplication.Value("QueuingEnabled") = 1
$comApplication.Value("QueueListenerEnabled") = 1
$comApplicationCollection.SaveChanges()
}

but when I try and run it it fails with this error:

Exception calling "SaveChanges" with "0" argument(s): "An operations error occurred. " + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ComMethodTargetInvocation + PSComputerName : MACHINE

If I exclude this line:

$comApplication.Value("QueuingEnabled") = 1

then it saves and creates the application correctly. If I run this script locally then it creates the application correctly on the local machine with QueuingEnabled=1, but always fails when running on a remote machine.

Why might this be?

1

There are 1 best solutions below

0
On

Try setting "Authentication" to 4 or 6 and see if that changes anything. See this.