[英]powershell finding disk raw or MBR/GPT
I am looking for AND condition in below command as I need offline and raw drives PS C:\\Users\\Administrator> Get-Disk |我在下面的命令中寻找 AND 条件,因为我需要离线和原始驱动器 PS C:\\Users\\Administrator> Get-Disk | where-Object IsOffline -EQ $true;
where-Object IsOffline -EQ $true;
PS C:\Users\Administrator> Get-disk
Number Friendly Name OperationalStatus Total Size Partition Style
------ ------------- ----------------- ---------- ---------------
0 AWS PVDISK SCSI Disk Device Online 100 GB MBR
1 AWS PVDISK SCSI Disk Device Offline 100 GB RAW
2 AWS PVDISK SCSI Disk Device Offline 100 GB RAW
So a few things wrong.所以有些事情是错误的。 I recommend learning the proper Powershell syntax.
我建议学习正确的 Powershell 语法。 Here is what you want to do.
这是你想要做的。
Get-Disk | Where partitionstyle -eq 'raw' | Out-file -FilePath C:\Users\user\Desktop\rawDisk.txt
Never use echo in powershell.切勿在 powershell 中使用 echo。 Use
write-output
if need be.如果需要,请使用
write-output
。 If writing to a file, the do out-file
.如果写入文件,则执行
out-file
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.