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
  • Here is a good Microsoft resource:

    blogs.technet.microsoft.com/.../

    If you are working with only a dozen servers, I would certainly recommend testing this to see if you can squeeze a little more performance out of interactive sessions.

    This will also help affect Scheduled Tasks by the same metric, but that is likely not a primary concern.

    Our library is not so large that I think you need to selectively import cmdlets. A selective import is useful with libraries which have hundreds or thousands of cmdlets. I have never encountered a customer who was selectively importing commands instead of simply loading the entire library, so I cannot speak to how that may function in a production environment.
Reply
  • Here is a good Microsoft resource:

    blogs.technet.microsoft.com/.../

    If you are working with only a dozen servers, I would certainly recommend testing this to see if you can squeeze a little more performance out of interactive sessions.

    This will also help affect Scheduled Tasks by the same metric, but that is likely not a primary concern.

    Our library is not so large that I think you need to selectively import cmdlets. A selective import is useful with libraries which have hundreds or thousands of cmdlets. I have never encountered a customer who was selectively importing commands instead of simply loading the entire library, so I cannot speak to how that may function in a production environment.
Children
No Data