I have a CSV File that contains the Disk number and Lun Name of disk I need mounted to my servers (hundreds of servers)
I want a powershell script that will parse the csv files (unique per server) in to a text file that will contain a series of diskpart commands.
so for example here is my CSV
Disk Number,Lun Name
I need the scriptto go through and pick out the Root and restore disks and create them first and assing them to the D: L: R: drives.
Then it will go through and pick out the remainder of the drives and format them,
The Script will need to parse the lun name and create folder names for the disk to mount to.
so the end result for example would be:
D:\ <Disk 021 mounted for D:>
D:\D1_DB11 <disk 002 mounted to this folder>
D:\D1_DB31 <Disk 004 mounted to this folder>
The Log drives are more complicated
L:\ <disk 022 mounted for L:>
L:\D1_Log11 <disk 003 mounted to this folder>
I know all the diskpart commands, what I don't know is how to get powershell to work with the CSV File, and do the Root/Restore Drives First.
Also How do I parse the volume name and pull out portions of it for volume names, folder names, etc.
If it matters the LUN name predeedign either _log or _data will aways be the same characther length as well as the server name.