Exchange Server TechCenter > Exchange Server Forums > High availability/Disaster Recovery > SCR Scripts for Creation of Storage Groups and DBs
Ask a questionAsk a question
 

AnswerSCR Scripts for Creation of Storage Groups and DBs

  • Monday, November 02, 2009 8:44 PMEbunky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi - I work for a company that will be using SCR between two sites.  4 exact same server and SAN hardware between both sites.  We will be utilizing 50 storage groups each on all 4 source servers - meaning 200 Storage Groups and Databases total.  I realize we can use the New-StorageGroup cmdlet wih the -StandbyMachine switch to create the SGs, but is there a way to set up variables to pull from a list of SG names, and file paths, so I do not have to write code for all 50 SGs, for 4 servers each?  I can't seem to find any sample cmdlets that I can change to fit our needs.  Any suggestions?  Thanks.
    Mike

Answers

  • Wednesday, November 04, 2009 5:31 AMAmit TankMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Try this...

    Create two CSV files with the desired SG/DB names and path...

    SGs.csv file content
    SG,LogFolderPath,SystemFolderPath
    SG01,D:\Mailbox\SG01,D:\Mailbox\SG01
    :
    :

    DBs.csv file content
    SG,DB,EDBFilePath
    SG01,DB01,D:\DatabaseFiles\SG01DB01.edb
    :
    :

    And run these two cmdlets, which will create SGs and DBs with the names and path defined in CSV file...

    Import-CSV SGs.csv | New-StorageGroup -Name $_.SG -Server ExchangeServerName -LogFolderPath:$_.LogFolderPath -SystemFolderPath:$_.SystemFolderPath

    Import-CSV DBs.csv | New-MailboxDatabase -StorageGroup $_.SG -Name $_.DB -EdbFilePath $_.EDBFilePath


    Amit Tank
    MVP: Exchange Server | MCTS: Microsoft Exchange Server 2010, Configuration
    MCITP: EMA | MCSA: M | Blog: http://ExchangeShare.WordPress.com


All Replies