The path parameter is required because Set-Content needs to know the location and the name
of the file to create. Using the encoding Ascii parameter allows for the formatting of the data. This
particular configuration has three disks with three variables for each disk. The disk number ($Disk#)
can be attained through diskpart or through diskmgmt.msc . The second value is the drive letter
($Disk#_Letter) and is used to assign the drive letter to the newly created logical drive. When each
partition is created, the partition is automatically sector aligned to the disk, via align=32 .
When DISKPART.EXE is run programmatically, the /s switch is required as well as the location of
the file. In the following example, diskpart uses all of the commands that were placed into the disk.txt
file, via the Set-Content cmdlet, and executes them using the disk variable listed previously:
Diskpart.exe /s $Disk
del $Disk
Once the disk creation is complete, the diskpart.txt file is deleted. Successful completion of the task
can be verified through disk manager ( diskmgmt.msc ). See Figure 13 - 8 .
Chapter 13: Single Copy Clusters
373
The next component is to format the newly created disks. When you assign drive letters to the
($Disk#_Letter) variables, those variables are then appended with a colon (:) and formatted using
the portion of the following script.
Pages:
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523