# 1. Get the first available 'Raw' disk that matches the specific name pattern $disk = Get-Disk | Where-Object { $_.PartitionStyle -eq 'Raw' -and $_.IsSystem -eq $false -and $_.FriendlyName -match "osfdisk" } | Select-Object -First 1 if ($disk) { Write-Host "Found matching disk: Number $($disk.Number) - FriendlyName: $($disk.FriendlyName)" -ForegroundColor Green # 2. Initialize the disk Write-Host "Initializing Disk $($disk.Number)..." Initialize-Disk -Number $disk.Number -PartitionStyle GPT -PassThru | # 3. Create a new partition using max size and FORCE drive letter Z # Note: This will fail if Z: is already in use by a network drive or USB stick. New-Partition -DriveLetter Z -UseMaximumSize | # 4. Format the volume Format-Volume -FileSystem NTFS -NewFileSystemLabel "OSF_Data" -Confirm:$false Write-Host "Drive setup complete! Volume mounted at Z:" -ForegroundColor Green } else { Write-Host "No uninitialized disks found with 'osfdisk' in the name." -ForegroundColor Yellow }