I've created a UFD-based fire computer image and will be sharing with other CTSP's in our upcoming meeting. My goal was to create a UFD that can be updated with the most current script fixes and URL updates. As such, I decided to use Dropbox for hosting the scripts and links. I used PowerShell to pull the information from Dropbox and update the scripts.
Here's an example:
When WinPE boots, the UFD is the D: drive. I also create a ROSS and I-Suite root subfolder on the clients. The problem I've found is when getting dispatched to a fire, there isn't much time to get I-Suite and ROSS before heading out. I wrote two simple scripts that rely on my Dropbox URL's to get the most current version of ROSS and I-Suite then save them to either the c:\ross/c:\isuite or d:\ross/d:\isuite folders.
Double click on ROSSUpdater.bat:
powershell -executionpolicy unrestricted .\rossdownloader.ps1
It starts ROSSDownloader.ps1:
#This first command looks for c:\ross and d:\ross then assigns $filename appropriately
if (test-path c:\ross){
$filename = ("c:\ross\" + (get-date -format "yy.MM.dd") + ".ROSS.EXE")}else{
if (test-path d:\ross){$filename = ("d:\ross\" + (get-date -format "yy.MM.dd") + ".ROSS.EXE")}}
#if neither folder exist then sends a message and exits
if ((!(test-path c:\ross)) -and (!(test-path d:\ross))){write-warning "There is no ROSS subfolder off the root of your UFD or C: drive";pause;exit}
#Sends warning message about the download
write-warning "Closing this window will cancel the ROSS download"
write-warning "The new ROSS executable is located in the UFD's ROSS folder"
write-host ("The new ROSS file is: " + $filename)-f green
#grab the Dropbox file URL to ROSS, assign it to a variable then #download the file to the $filename folder
$ross = (new-object system.net.webclient).downloadstring("https://dl.dropboxusercontent.com/s/pz22mvi15sjp2y8/ross.txt")
(new-object system.net.webclient).downloadfile($ross,$filename)
#Check to ensure the file downloaded then send a message
if (test-path $filename){write-host "Download Complete"-f blue;timeout 30}else{write-warning "Something went wrong, download was not successful.";pause}
This technique is dependent on keeping up with the ROSS/ISuite URL's in Dropbox but changing it in one place will help all those who use this script.
No comments:
Post a Comment