远程Windows计算机操作系统根驱动器号

问题描述 投票:0回答:1

如何通过Windows命令提示符或power shell命令在Windows操作系统的远程计算机上找到os根驱动器的字母(例如C或D等...)。

在本地电脑中,“set systemroot”命令可以获取Windows根驱动器,但我想要远程计算机的这个等效命令...

windows powershell networking command-prompt
1个回答
0
投票

查询WMI,Win32_OperatingSystem类;

OS驱动器号

Get-CimInstance -Class Win32_OperatingSystem -ComputerName localhost -Property SystemDrive | Select-Object -ExpandProperty SystemDrive

要么

Get-WmiObject -Class Win32_OperatingSystem -ComputerName localhost -Property SystemDrive | Select-Object -ExpandProperty SystemDrive

Windows目录

Get-CimInstance -Class Win32_OperatingSystem -ComputerName localhost -Property WindowsDirectory | Select-Object -ExpandProperty WindowsDirectory

要么

Get-WmiObject -Class Win32_OperatingSystem -ComputerName localhost -Property WindowsDirectory | Select-Object -ExpandProperty WindowsDirectory
© www.soinside.com 2019 - 2024. All rights reserved.