This command finds uninitialized disks and initializes them using the GPT partition style:
Get-Disk | Where PartitionStyle -eq "RAW" | Initialize-Disk -PartitionStyle GPT
Step-by-step explanation
1. Get-Disk
Get-Disk
Lists disks connected to the system.
It shows information such as:
Number
FriendlyName
OperationalStatus
Size
PartitionStyle
2. Where PartitionStyle -eq "RAW"
Where PartitionStyle -eq "RAW"
Filters only disks where the PartitionStyle is RAW.
RAW usually means:
The disk has not been initialized yet.
So PowerShell is looking for a new/unprepared disk.
3. Initialize-Disk -PartitionStyle GPT
Initialize-Disk -PartitionStyle GPT
Initializes the selected RAW disk and sets the partition style to GPT.
GPT means:
GUID Partition Table
GPT is the modern partitioning style and is recommended for most new systems. Your lab notes explain that GPT is more modern and reliable than MBR, supports many partitions, and supports disks larger than 2 TB.
Full meaning
Get-Disk | Where PartitionStyle -eq "RAW" | Initialize-Disk -PartitionStyle GPT
means:
Get all disks, find the disks that are not initialized, and initialize them using GPT.
Important warning
This command can affect disks. Students should run it only on a test VM disk, not on a real important disk.
Safer version:
Get-Disk | Where-Object PartitionStyle -eq "RAW"
First check which disk is RAW.
Then initialize a specific disk:
Initialize-Disk -Number 1 -PartitionStyle GPT
What comes after this?
Initializing the disk does not create a usable drive letter yet.
Usually the next steps are:
New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter
Then format it:
Format-Volume -DriveLetter E -FileSystem NTFS -NewFileSystemLabel "DataDisk"
Student comment
# This command finds disks with RAW partition style and initializes them as GPT.
# RAW means the disk is not initialized. GPT is the modern partition style.
Ref: AI/ChatGPT
