How to connect to ARS v8 from PowerShell?

I have the following function in PowerShell:

Function Get-ARSServers {

$searchRoot = "CN=Enterprise Directory Manager,CN=Aelita,CN=System,$([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().GetDirectoryEntry() | Select-Object -ExpandProperty DistinguishedName)"


Get-QADObject -SearchRoot $searchRoot -Type serviceConnectionPoint | SELECT-object -ExpandProperty Name | Where-object { $_.indexOf(":17228") -gt 0 } | Select-object @{name='serverName';expression={$_.split(":")[0]}} | select-object -ExpandProperty serverName

}

This is then called via this code:

$QARSServerFQDN = Get-ARSServers | Select-Object -First 1
Connect-QADService -Service $QARSServerFQDN -Proxy

However, I get an error and I'm not sure why:

Get-QADObject : The pipeline has been stopped.
At C:\ARS Scripts\lzcreation.ps1:267 char:5
+ Get-QADObject -SearchRoot $searchRoot -Type serviceConnectionPo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-QADObject], PipelineStoppedException
+ FullyQualifiedErrorId : ActiveRoles.ManagementShell.Powershell.Cmdlets.GetGenericObjectCmdlet

Parents
  • Same error - as written

    try replacing
    $QARSServerFQDN = Get-ARSServers | Select-Object -First 1

    with

    $QARSServerFQDN = (Get-ARSServers)[0]

  • I get this now:
    Connect-QADService :
    The remote endpoint does not exist or could not be located.
    At C:\ARS Scripts\lzcreation.ps1:360 char:9
    + Connect-QADService -Service $QARSServerFQDN -Proxy
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Connect-QADService], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,ActiveRoles.ManagementShell.Commands.ConnectCmdlet

  • Interesting - your script worked for me with the change suggested.
    when you run get-arsservers - are you getting back a list of ARS host FQDN's ?

  • In the lab there is only one server, but yes I am.

    I left the function the same and changed the code to complete a write-host of the variable:
    #Get the currently active ARS server
    $QARSServerFQDN = (Get-ARSServers)[0]
    #Connect to Active Roles Server
    write-host $QARSServerFQDN
    Connect-QADService -Service $QARSServerFQDN -Proxy

    This produced the following:
    A
    Connect-QADService :
    The remote endpoint does not exist or could not be located.
    At C:\ARS Scripts\temporarycode.ps1:13 char:9
    + Connect-QADService -Service $QARSServerFQDN -Proxy
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Connect-QADService], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,ActiveRoles.ManagementShell.Commands.ConnectCmdlet

    As you can see the write-host only contains the letter A.

Reply
  • In the lab there is only one server, but yes I am.

    I left the function the same and changed the code to complete a write-host of the variable:
    #Get the currently active ARS server
    $QARSServerFQDN = (Get-ARSServers)[0]
    #Connect to Active Roles Server
    write-host $QARSServerFQDN
    Connect-QADService -Service $QARSServerFQDN -Proxy

    This produced the following:
    A
    Connect-QADService :
    The remote endpoint does not exist or could not be located.
    At C:\ARS Scripts\temporarycode.ps1:13 char:9
    + Connect-QADService -Service $QARSServerFQDN -Proxy
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Connect-QADService], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,ActiveRoles.ManagementShell.Commands.ConnectCmdlet

    As you can see the write-host only contains the letter A.

Children
No Data