Exchange Server TechCenter >
Exchange Server Forums
>
High availability/Disaster Recovery
>
SCR Scripts for Creation of Storage Groups and DBs
SCR Scripts for Creation of Storage Groups and DBs
- 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
- Try this...Create two CSV files with the desired SG/DB names and path...SGs.csv file contentSG,LogFolderPath,SystemFolderPathSG01,D:\Mailbox\SG01,D:\Mailbox\SG01::DBs.csv file contentSG,DB,EDBFilePathSG01,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- Proposed As Answer byJames-LuoMSFT, ModeratorWednesday, November 04, 2009 5:50 AM
- Marked As Answer byJames-LuoMSFT, ModeratorMonday, November 09, 2009 12:59 AM
All Replies
- This might help you out http://social.technet.microsoft.com/Forums/en-US/exchangesvrdeploy/thread/9ffef68a-274a-4d68-827a-7519fa0caed6
Raj- Proposed As Answer byJames-LuoMSFT, ModeratorTuesday, November 03, 2009 6:15 AM
- Thanks, that helps some, but I am looking for a way to actually setup variables within the PwoerShell script to go out and look up the names of the Storage Groups and Databases and Paths, and then populate the script on the fly as it creates them. This would keep me from having to write 100 lines of code per server (50 for the SGs and 50 for the DBs). I wish I were a code writer, but because I am not, I may have to write all that because it will be easier than using the EMC to crete them all.
can you also put this query on development section of the forum http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads.
Raj- Try this...Create two CSV files with the desired SG/DB names and path...SGs.csv file contentSG,LogFolderPath,SystemFolderPathSG01,D:\Mailbox\SG01,D:\Mailbox\SG01::DBs.csv file contentSG,DB,EDBFilePathSG01,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- Proposed As Answer byJames-LuoMSFT, ModeratorWednesday, November 04, 2009 5:50 AM
- Marked As Answer byJames-LuoMSFT, ModeratorMonday, November 09, 2009 12:59 AM


