Jump to content

Recommended Posts

Posted (edited)

Hi everyone,

 

I've been working with Solus 3 a bit recently for a few schools. I've just finished a script to help deploy the Agent to workstations. Its basically a replacement for the AgentInstaller.js script that capita provide but its vbscript instead (just my preference).

 

I needed a rework of the original script as we deploy software using SCCM from a central point to several schools. There are 2 differences really, firstly, this script passes the KeyFileName parameter (missing from the capita script) and KeyFileNamePath point to a subfolder of the installation source to accommodate different schools key files in one package.

 

The second change performs a lookup in the Solus 3 Database to see if the workstation has an agent id already registered which will be re-used if found. A new GUID is generated if not. This means no additional steps should be required in the Solus console for re-installations or re-imaged workstations.

 

Place this script in a folder with the x86 and x64 msi files and the Solus3.Keys.DeploymentService.Public.xml key file generated by exporting the installer from the Solus Console.

 

All the variables you need to set for your site are in the marked section near the top. And you should easily be able to deploy this using a GPO if you don't have SCCM.

 

 

Dim wshShell, wshSysEnv
Dim fso, AgentID
Dim SolusServer, SolusDatabase, SolusDB, RS
Dim logFileName, agentAddress, dsAddress
Dim keyFileName, keyFileNamePath, agentGUID

Set fso = CreateObject("Scripting.FileSystemObject")
Set wshShell = WScript.CreateObject("WScript.Shell")

'--Site/School Specific Variables--'
SolusServer = "SIMSSERVER\SIMS"
SolusDatabase = "solus3_deployment_server"
dsAddress = "net.tcp://misserver.local:52965"
keyFileName = "Solus3.Keys.DeploymentService.Public.xml"
'----------------------------------'

keyFileNamePath = wshShell.CurrentDirectory
logFileName = fso.BuildPath(wshShell.Environment("SYSTEM")("TEMP"), "Solus3_Agent_install.log") 
agentAddress = "net.tcp://localhost:52966"


Set SolusDB = CreateObject("ADODB.Connection")
SolusDB.CommandTimeout = 15
SolusDB.ConnectionString = "Driver={Sql Server};Server=" & SolusServer & ";Database=" & SolusDatabase & ";Trusted_Connection=True;"
SolusDB.Open()
Sql = "SELECT [agent_guid] FROM solus3.agent where name like '" & wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%") & "%'"
Set RS = CreateObject("ADODB.Recordset")
RS.CursorLocation = 3
RS.Open Sql, SolusDB

If RS.RecordCount = 0 then
 agentGUID = CreateGUID 
Else
 agentGUID = LCase(Replace(Replace(RS("agent_guid"), "{", ""), "}", ""))
End If
RS.Close
SolusDB.Close

Set SystemEnvVars = wshShell.Environment("System")

if Instr(SystemEnvVars("PROCESSOR_ARCHITECTURE"), "64") then
 msi = "SOLUS3AgentInstaller_x64.msi"
else
 msi = "SOLUS3AgentInstaller_x86.msi"
end if

cmdLine = "msiexec.exe /l*v """ & logFileName & """ /qn /i " & msi & " AGENTSERVICEADDRESS=" & agentAddress & _
         " AGENTID=" & agentGUID & _
         " DEPLOYMENTSERVERADDRESS=" & dsAddress & " RSAKEYPATH=" & keyFileNamePath & _
         " RSAKEYFILENAME=" & keyFileName 

wshShell.Run(cmdLine)
'wscript.echo(cmdLine)

Function CreateGUID
 Dim TypeLib
 Set TypeLib = CreateObject("Scriptlet.TypeLib")
 CreateGUID = Mid(TypeLib.Guid, 1, 38)
End Function

Edited by Richie
  • Thanks 1
Posted
That's pretty cool, won't you get access denied \ a new guid every time because SCCM runs as the local service account and thus get access denied when querying the S3 db?
Posted (edited)

Actually yes in the code I posted. 'Trusted_Connection=True' should be removed and 'Uid=;Pwd=;'added to the SQL connection string. A simple SQL login can be created on your solus3_deployment_database, you can set it to have read permission on just the solus3.agent table. During testing, the script was working under a more privileged account so a trusted connection worked.

 

This isn't finished yet, I still have more to try out. For a start, theres no error checking so if the script bombs (maybe a sql error) theres no clean exit. Secondly, theres a particular behaviour of the Solus Agent I need to investigate regarding pulling down a SIMS client on a newly imaged workstation that has no SIMS installation. Currently it doesn't but I think theres a way if triggering this. Thats for tomorrow. I'll post an update if theres any news

Edited by Richie
Posted

No SOLUS3 won't push out SIMS until you add the S3 client to the SIMS workstation group within SOLUS3. You have to think of SOLUS3 as Capita, so it deals with SIMS, Discover, FMS, so you have to pick which one you want. Lucky, because your re-using the GUID, it's a one-time activity - assuming you don't change your computer names every 5 mins.

 

It does means you can install the SOLUS3 UI on the data managers PC and they can manage who gets SIMS\FMS\Discover, but you don't have to give them any admin permissions on all the workstations.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...