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)