If you want to flash multiple Photons remotely with the same .bin file then here is one way to do it using a VBScript.
For this example, here is what you will need.
-Particle CLI installed
-
A compiled .bin file(on your C drive). As described here. Particle CLI. Take note of the file’s name. Mine is “photon_firmware_1470265344230.bin”
-
A file named Photon_Names.txt on your C drive containing the names of the Photons you want to flash in list form.
-
A .vbs file on your C drive containing to code below. I’m using PhotonBatchUpdate.vbs, but the actual name is not important. Where NameOfBinFile = “The name of your .bin file”.
'wscript.echo “BEGIN”
Dim fso, f, oShell, PhotonName, PathToNames, NameOfBinFile
PathToNames = “C:\Photon_Names.txt”
NameOfBinFile = “photon_firmware_1470265344230.bin”
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set f = fso.OpenTextFile(PathToNames)
Set oShell = WScript.CreateObject (“WScript.Shell”)
oShell.run “cmd /K CD C:”
Do Until f.AtEndOfStream
PhotonName = f.ReadLine
'WScript.Echo PhotonName
oShell.run “%comspec% /k particle flash” & " " & PhotonName & " " & NameOfBinFile
WScript.Sleep 1000
Set oWmg = GetObject(“winmgmts:”)
strWndprs = “select * from Win32_Process where name=‘cmd.exe’”
Set objQResult = oWmg.Execquery(strWndprs)
For Each objProcess In objQResult
intReturn = objProcess.Terminate(1)
Next
Loop
f.Close
wscript.quit
Before running the .vbs script(by double-clicking it) you would manually login to your account using command line “particle login”. Then run the script. It will loop through each device name in the Photon_Names.txt file and flash the device with the .bin file.
Note: If you comment in the 'wscript.echo “BEGIN” and 'WScript.Echo PhotonName lines then message boxes will appear showing the current Photon name it is flashing to.
Hope this comes in handy for anyone wanting to update multiple Photons without doing it manually.