In Magento 1 i used something like this to create 2000 store views on the fly. How would I do the same thing in Magento 2?
require_once('app/Mage.php');
umask(0);
Mage::app('admin');
$strnm =1;
while ($strnm < 2001){
$store = Mage::getModel('core/store');
$store->setCode('tsm'.$strnm)
->setWebsiteId(1)
->setGroupId(1)
->setName('TSM'.$strnm )
->setIsActive(1)
->save();
$strnm += 1;
}