Quantcast
Viewing all articles
Browse latest Browse all 21975

2 arrays in a foreach

Hi

I have 2 arrays:

Array:  $allDB

NewContentDB_20130617_121431.BAK
SecureStoreDB_20130617_121431.BAK
sp2013DBconfig_20130617_121431.BAK
SP2013_State_Service_20130617_121431.BAK
SPenterpriseSearchDB_20130617_121431.BAK
SPprofileDB_20130617_121431.BAK
SPSearchServiceDB_20130617_121431.BAK
SPSearchServiceDB_AnalyticsReportingStore_20130617_121431.BAK
SPSearchServiceDB_CrawlStore_20130617_121431.BAK
SPSearchServiceDB_LinksStore_20130617_121431.BAK
SPsocialDB_20130617_121431.BAK
SPsyncDB_20130617_121431.BAK
SP_ContentDB_MySite_20130617_121431.BAK
SP_Content_CA_20130617_121431.BAK
SP_Metadata_Service_20130617_121431.BAK
webapp1ContentDB_20130617_121431.BAK
WSS_Content_20130617_121431.BAK
WSS_UsageApplication_20130617_121431.BAK

and

Array: $databasenames

NewContentDB
SecureStoreDB
sp2013DBconfig
SP2013StateService
SPenterpriseSearchDB
SPprofileDB
SPSearchServiceDB
SPSearchServiceDBAnalyticsReportingStore
SPSearchServiceDBCrawlStore
SPSearchServiceDBLinksStore
SPsocialDB
SPsyncDB
SPContentDBMySite
SPContentCA
SPMetadataService
webapp1ContentDB
WSSContent
WSSUsageApplication

So what i want to acheive is restoring my databases with..unfinished:

foreach ($DB in $databasenames)
{

RestoreDB $DB ('C:\SQLBackup\12 juni 2013\SQLbackup\' + $allDB[0])

}
The Problem is that I dont know how I can select both the first position of Arrays  $allDB and $databasenames in the "foreach" statement, so that through first run position of both arrays 1 ([0]) will be picked, then next time position 2,....etc

This is because $DB gives the database a name, while $Databasenames is the filename. So they have to fit:-)

Im quite stuck on this :\

any help will be greatly appriciated!

br

Bjorn



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>