Get-PSDrive 帮助信息

本文介绍如何使用Get-PSDrive命令获取Windows PowerShell驱动器的相关信息。包括命令的基本语法、参数说明、输入输出类型及常见用例等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 如下说明是翻译PowerShell: help Get-PSDrive 产生的帮助信息.

译者: Edengundam(马涛)
 
Get-PSDrive
 
大纲
取得Windows PowerShell驱动器的信息.
 
语法
Get-PSDrive [[-name] <string[]>] [-pSProvider <string[]>] [-scope <string>] [<CommonParameters>]
 
Get-PSDrive [-literalName] <string[]> [-pSProvider <string[]>] [-scope <string>] [<CommonParameters>]
 
详细描述
取得Windows PowerShell驱动器的信息. 如果没有指定驱动器, 此命令取得当前名称空间中所有的Windows PowerShell驱动器信息.
 
参数
 
-name <string[]>
指定要取得的Windows PowerShell驱动器的名称. 要指定多个Windows PowerShell驱动器, 使用逗号将它们分隔开.
 

强制参数?
false
参数位置?
1
默认值
*
允许从管道绑定输入?
true (根据属性名)
允许通配符扩展?
true
 
-PSProvider <string[]>
此参数将返回指定提供程序支持的驱动器的信息, 这些信息以PSDriveInfo对象表示.
 

强制参数?
false
参数位置?
named
默认值
*
允许从管道绑定输入?
true (根据属性名)
允许通配符扩展?
true
 
-scope <string>
指定搜索Windows PowerShell驱动器的作用域.
 

强制参数?
false
参数位置?
named
默认值
String.empty
允许从管道绑定输入?
true (根据属性名)
允许通配符扩展?
false
 
-literalName <string[]>
指定查询项. 参数LiteralName的值将会按照输入的样子被准确的引用. 不会对任何通配符进行解释. 如果路径中包含了转义字符, 需要将路径用单引号保护. 单引号指示Windows PowerShell不对字符串中的转义字符进行处理.
 

强制参数?
true
参数位置?
1
默认值
 
允许从管道绑定输入?
true (根据属性名)
允许通配符扩展?
false
 
<公共参数>
此命令支持公共参数: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. 更多信息, 输入, "get-help about_commonparameters".
 
输入类型
String or pipelined object
 
返回类型
A PSDriveInfo object.
 
注意
 
更多信息, 输入"Get-Help Get-PSDrive -detailed". 需要技术信息, 输入"Get-Help Get-PSDrive -full".
 
如果需要为该命令提供多个参数, 请使用逗号进行分隔. 例如, "<parameter-name> <value1>, <value2>".
 
1
 
C:/PS>get-psdrive
 
此命令显示当前所有可见的驱动器.
 
2
 
C:/PS>get-psdrive HK*
 
此命令显示名称以HK开头的驱动器信息. 默认情况下, 显示的结果将是映射到注册表提供程序的所有驱动器信息.
 
相关链接
New-PSDrive
Remove-PSDrive
Get-Help
Get-Command
Get-Member
$checkpath="C:\healthcheck\"+$(hostname)+"_"+$(Get-Date -Format yyyymmdd) $checkpath if (test-path -path $checkpath){ "Path exist" } else { New-Item -ItemType Directory -Path $checkpath } $(hostname)+" health report about "+$(Get-Date)>> $checkpath\checkrecord.log "`n#check date" >> $checkpath\checkrecord.log Get-Date -Format yyyyddmm >> $checkpath\checkrecord.log "`n#check OS" >> $checkpath\checkrecord.log systeminfo | findstr "OS" >> $checkpath\checkrecord.log "`n#check java" >> $checkpath\checkrecord.log Get-Command java | Select-Object version >> $checkpath\checkrecord.log "`n#check disk" >> $checkpath\checkrecord.log Get-PSDrive | findstr "C:\" >> $checkpath\checkrecord.log "`n#check CPU" >> $checkpath\checkrecord.log Get-WmiObject Win32_Processor |Measure-Object -Property LoadPercentage -Average | select Average >> $checkpath\checkrecord.log "`n#check memory" >> $checkpath\checkrecord.log Get-WmiObject Win32_PhysicalMemory |Measure-Object -Property capacity -Sum | %{$_.sum/1Mb} >> $checkpath\checkrecord.log "`n#check IP" >> $checkpath\checkrecord.log ipconfig >> $checkpath\checkrecord.log "`n#check port opening" >> $checkpath\checkrecord.log netstat -an | findstr 443 >> $checkpath\checkrecord.log netstat -an | findstr 1433 >> $checkpath\checkrecord.log "`n#check service" >> $checkpath\checkrecord.log net start | findstr Apa* >> $checkpath\checkrecord.log net start | findstr SQL* >> $checkpath\checkrecord.log #& "C:\Program Files\Apache Software Foundation\Tomcat 10.1.19\bin\version.bat" > $checkpath\tomcat_ver.log "C:\Users\Administrator\Desktop\apache-tomcat-9.0.90\bin\version.bat" > $checkpath\tomcat_ver.log #$last_log_file=$(Get-Item "C:\Program Files\Apache Software Foundation\Tomcat 9.0.69\logs\catalina*" | Sort-Object LastWriteTime -Descending |Select-Object -Last 1|Select-Object Name) #$last_log_file #Get-ChildItem "C:\Program Files\Apache Software Foundation\Tomcat 9.0.69\logs\" -File|findstr catalina* | Sort-Object LastWriteTime -Descending |Select-Object -Last 1|Select-Object BaseName #Get-Item "C:\Program Files\Apache Software Foundation\Tomcat 9.0.69\logs\catalina*" | Sort-Object LastWriteTime -Descending |Select-Object -Last 1|Select-Object Name #Get-Content -path "C:\Program Files\Apache Software Foundation\Tomcat 9.0.69\logs\catalina..log" -tail 1000 > $checkpath\tomcat.log #[Net.ServicePointManager]::ServerCertificateValidationCallback ={$ture} #Invoke-WebRequest -Uri http://10.56.7.21/bcrf -UseBasicParsing | Select-Object -expand statusCode > $checkpath\checkweb.log Get-Content -path "C:\bcrfLog\logs\debug.log" -tail 1000 > $checkpath\debug.log # check backup log ls "C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup\" > $checkpath\dbback.log #check db log Get-Content -path "C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Log\ERRORLOG" -tail 1000 > $checkpath\db.log 帮我解释这个win server 2019 上的健康检查脚本,并给出改善建议
03-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值