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
  • No, I haven't tried this. To be honest it is not a concept I am familiar with. I think I have read about it. I try to make my QARS scripts 'standalone' as they are often then run from up a number of servers (perhaps a dozen) by any of several admins plus a couple of service accounts.

    If I understand the concept of what you are suggesting correctly, I *think* I would need to configure the PS profile of all the relevant accounts on all the servers.

    If there was a significant performance improvement then it might be worth it, especially for scripts run interactively (ie by people). I am not sure how it would work and whether it would offer any benefit for scripts started by Scheduled Task?

    I do talk to the QARS Admin on a semi regular basis (normally to tell him he has an issue he needs to look at) and the environment did have a virtual hardware uplift at one point which gave a significant improvement (measured).

    If you say 10s is reasonable, then that is good enough for me and a good improvement over the 30-40s I was used to previously.

    One other idea I have had but not tested is that I believe you can do an Import-Module and specify only certain cmdlets to be loaded. I don't know if that is true with QARS or not. However if the module is genuinely only taking 2 seconds to load I can't really expect better than that. If it simply taking 2 seconds to acknowledge the command and then spending 30 seconds in the background actaully doing it, then this concept might have more practical value.
Reply
  • No, I haven't tried this. To be honest it is not a concept I am familiar with. I think I have read about it. I try to make my QARS scripts 'standalone' as they are often then run from up a number of servers (perhaps a dozen) by any of several admins plus a couple of service accounts.

    If I understand the concept of what you are suggesting correctly, I *think* I would need to configure the PS profile of all the relevant accounts on all the servers.

    If there was a significant performance improvement then it might be worth it, especially for scripts run interactively (ie by people). I am not sure how it would work and whether it would offer any benefit for scripts started by Scheduled Task?

    I do talk to the QARS Admin on a semi regular basis (normally to tell him he has an issue he needs to look at) and the environment did have a virtual hardware uplift at one point which gave a significant improvement (measured).

    If you say 10s is reasonable, then that is good enough for me and a good improvement over the 30-40s I was used to previously.

    One other idea I have had but not tested is that I believe you can do an Import-Module and specify only certain cmdlets to be loaded. I don't know if that is true with QARS or not. However if the module is genuinely only taking 2 seconds to load I can't really expect better than that. If it simply taking 2 seconds to acknowledge the command and then spending 30 seconds in the background actaully doing it, then this concept might have more practical value.
Children
No Data