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
  • I started off doing this, but of course ran into an issue when that server inevitably encountered a problem. The advice I was given at that time was to just use the -proxy and let the system sort itself out.
    I have created code to test the response time of all servers and then use the fastest, but the benefit of that is lost as soon as it tests a 'bad' server which can then take quite a while to respond or fail or timeout.
    I am happy to accept the AD latency side of things. As I say, so long as I am doing the best I can, that is good enough. I do not have a *need* to get the best possible performance. I would just like to make sure I'm doing things correctly and not running foul of easily avoidable issues.
    Currently it seems that the Add-PSSnapin method is best avoided. Just that still represents a big step forward for me.
Reply
  • I started off doing this, but of course ran into an issue when that server inevitably encountered a problem. The advice I was given at that time was to just use the -proxy and let the system sort itself out.
    I have created code to test the response time of all servers and then use the fastest, but the benefit of that is lost as soon as it tests a 'bad' server which can then take quite a while to respond or fail or timeout.
    I am happy to accept the AD latency side of things. As I say, so long as I am doing the best I can, that is good enough. I do not have a *need* to get the best possible performance. I would just like to make sure I'm doing things correctly and not running foul of easily avoidable issues.
    Currently it seems that the Add-PSSnapin method is best avoided. Just that still represents a big step forward for me.
Children
No Data