Batch File Command
The batch file command is designed to execute multiple commands using a single command.
-operation BatchFile -filepath "C:\temp\batchfile.txt"
Example: Batch File
A batch file containing multiple commands, one command per line.
The MVSP console app uses specific file system directories at runtime in order to generate and output files. Therefore concurrent processing is not supported. Only run one instance of MVSP at any one time.
Batch files can be used to execute hundreds of commands by running a single command.
It is not recommend to provisioning thousands of items in a single batch file.
Provisioning also has to happen following a top down sequence, create the site collections first, then add the solution to each site collection, next create the sites and finally create the libraries.
For example create 3-4 site collections, then add solutions to each site collection, then create the sites and so on. Once the end to end process has been run and the outcome validated, then scale as required.
Recommended Batch File Sizes
The recommended batch file sizes are:
- Create Site Collection (5-10 at a time);
- Add Solution (10-20 at a time);
- Create Site (100-500 at a time);
- Create Library (100-500 at a time);
Processing times can vary depending on the environment and performance of the SharePoint farm.
For Office 365 provisioning times and outcomes can vary on a daily basis. It is recommended to start with small to medium batch sizes and then scale batch size based on successful batch runs and desired timeframes.
Use ConsoleCommands.xlsx to create a batch file
Please use the provided Excel spreadsheet ConsoleCommands.xlsx to a create a batch file.
The spreadsheet contains tabs, one for each type of command.
The most commonly used tabs are:
- Create Site Collection
- Add Solution (used to add site columns and content types to existing site collections)
- Create Site (in existing site collections)
- Create Library (in existing site collections and sites)
Lets create 20 sites in an existing site collection
Open the ConsoleCommands.xlsx spreadsheet and go to the Create Site tab.
Enter the values into the provided columns and use the drag technique to replicate the provided Batch File Command column cell formula to all the required rows.
Next, select the Batch File Command column and copy / paste the commands into a text file (i.e. batchfile.txt) to create a batch file.
Save the text file, give it a name and most importantly set the encoding to be UTF-8.
Execute the Batch File
The text file can then be specified as input for the console command.
Run > Command Prompt
Run a command prompt using the Windows Start button and search for Command Prompt (CMD)
cd "C:\Program Files\MacroView\MVSP\Standalone"
Use the ConsoleCommand.xlsx spreadsheet to author a batch file command.
Open the spreadsheet and go to the Execute Batch File tab.
Fill in the provided columns and copy / paste the Batch File Command to the command prompt window.
C:\Program Files\MacroView\MVSP\Standalone>MacroView.Solutions.Provisioning.Console.exe -operation BatchFile -filepath "C:\temp\batchfile.txt"
C:\ProgramFiles\MacroView\MVSP\Standalone> MacroView.Solutions.Provisioning.Console.exe -operation BatchFile -filepath "C:\temp\batchfile.txt"
Result (batch file run)
The results of a batch file run are written to a CSV file.
The output and statistics displayed above are written to the log file.
We also support batch files that contain a mix of different commands
Below is a sample text file containing a mix of different commands.
It is the responsibility of the user creating the batch file to ensure that entries are ordered such that the pre-requisite areas are created first.
For example: a site collection is created first, followed by sub-sites, then libraries.
Continue to Part 9 - Logging and Troubleshooting