This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Best way to Connect to QARS Service? in PowerShell (As quickly as possible)

Hi, 

I'm frustrated by how long it can take to get a usable QARS connection established in my scripts.

The code I have mostly used is:

## Load QARS Module
if ( (Get-PSSnapin -Name Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue) -eq $null )
{
  Write-Host "Adding Quest ActiveRoles Module" -foregroundcolor Blue
  Add-PSSnapin Quest.ActiveRoles.ADManagement
}

## Connect to QARS
Write-Host "Attempting to connecting to QADService" -foregroundcolor Blue
try { $connectAttempt = Connect-QADService -proxy }
catch { Write-Host "Connection attempted errored - Please try rerunning script" -ForegroundColor Red
        exit
}
finally { 
    Write-Host "Value of `$connectAttempt is $connectAttempt"
    if ("$connectAttempt" -match "Quest.ActiveRoles.ArsPowerShellSnapIn.Data.ArsServerConnection") {
        Write-Host "Connection attempt appears to have been successful`n" -ForegroundColor DarkGreen
    }
 }

This works, but loading the Snapin takes quite a while.  Whilst searching for a faster way I learned that the Get-PSSnapin syntax is deprecated.  So I have been attempting to load the module using:

Set-Location "C:\Program Files\Quest Software\Management Shell for AD"
Import-Module .\Quest.ActiveRoles.ArsPowerShellSnapIn.dll

This seems much quicker - However when I then attempt to connect to QARS (using same code as in first snippet) the connection can take a long time to establish.

I have failed to find any useful documentation on this - I am happy to read anything people can link me to? 

Alternatively, could anyone share their experiences and or chosen way to manage the load of the module and connect to the service.  I'd really like to find the fastest method I can for this, to include in frequently run scripts.

Thanks in advance,

Andrew

PS Should probably have said the environment I am in uses 6.9.0 I believe (based on install files I used)

Parents
  • What are the actual connection times which you are seeing?

    Your cmdlets seem to be perfectly fine. There are no bottlenecks in the code itself which I can see. In my lab, these cmdlets processed in less than two seconds when running on a test machine, and in less than a second when running on the ActiveRoles Server host itself.

    Do you see a significant performance difference between running these cmdlets on your usual machine versus running them on the actual ActiveRoles Server host?

    There are many factors which can impact performance i.e. networking and resource considerations.

    What is the latency between the machine where you are running the connection and the ActiveRoles Server host? What are the resources assigned to the ActiveRoles Server host?
Reply
  • What are the actual connection times which you are seeing?

    Your cmdlets seem to be perfectly fine. There are no bottlenecks in the code itself which I can see. In my lab, these cmdlets processed in less than two seconds when running on a test machine, and in less than a second when running on the ActiveRoles Server host itself.

    Do you see a significant performance difference between running these cmdlets on your usual machine versus running them on the actual ActiveRoles Server host?

    There are many factors which can impact performance i.e. networking and resource considerations.

    What is the latency between the machine where you are running the connection and the ActiveRoles Server host? What are the resources assigned to the ActiveRoles Server host?
Children
No Data