Why does installing a "QueuingEnabled" COM + application remotely using powershell cause saving to fail?

I have this powershell script that creates 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 to 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 correctly creates the application. If I run this script locally, then it correctly creates the application on the local computer with QueuingEnabled=1, but always does not work when working on a remote machine.

Why could this be?

+4
source share
1 answer

"" 4 6 , -. . .

0

Source: https://habr.com/ru/post/1537688/


All Articles