Automate RSA SecurID token authentication

Script to automatic RSA SecurID token authentication by opening up RSA, send the PIN, then copy the token and close RSA.

‘ Opens RSA SecurID application, sends out the PIN code and then closes it

‘ Kill current open process
myProcess=”SecurID.exe”
Set Processes = GetObject(“winmgmts:”).InstancesOf(“Win32_Process”)
For Each Process In Processes
If StrComp(Process.Name, myProcess, vbTextCompare) = 0 Then
Process.Terminate()
End If
Next

‘ Main code
SecApp = “C:\Program Files (x86)\RSA SecurID Software Token\SecurID.exe”
Set SecObj = CreateObject(“WScript.Shell”)
SecObj.Exec(SecApp)
WScript.Sleep 1000
MySendKeys(“12345”) ‘send PIN
MySendKeys(“{ENTER}”)
MySendKeys(“^{c}”) ‘send CTRL+C
MySendKeys(“%{F4}”)

‘ Function to sendkeys
Function MySendKeys(keys)
SecObj.AppActivate(SecApp)
WScript.Sleep 250
SecObj.SendKeys(keys)
End Function