# 监控磁盘使用情况(可用空间、已使用空间等)Get-Volume|Select-ObjectDriveLetter, FileSystemLabel,@{Name="UsedSpace(GB)";Expression={$_.SizeUsed/1GB}},@{Name="FreeSpace(GB)";Expression={$_.SizeRemaining/1GB}}# 生成磁盘使用情况报告Get-Volume|Format-TableDriveLetter, FileSystemLabel,@{Name="Use...
可以运行Get-PSDrivecmdlet 来确认是否已创建驱动器。 PowerShell Get-PSDrive 创建新的 PSDrive 后即可开始进行导航。 PowerShell dir SQLonDocker:\Databases 输出可能如下所示。 你可能会注意到,此输出类似于 SSMS 在数据库节点中显示的内容。 它显示用户数据库,而不显示系统数据库。
Get-ItemProperty-PathHKCU:\Network\* |ForEach-Object{Set-ItemProperty-Path$_.PSPath-NameRemotePath-Value$_.RemotePath.ToUpper() } You can use this format to change the form or content of a registry entry value. Each subkey in theNetworkkey represents a mapped network drive that reconnects...
Check Free Disk Space on a Specific Drive Letter By specifying the drive letter, you can limit the result to a specific volume. For example, the below command returns the free disk space information on drive D. Get-Volume -DriveLetter D Check Free Disk Space Based on Drive Type In most ...
{CustomLogPluginClsid=; Directory=%SystemDrive%\i netpub\logs\LogFiles; Enabled=True; LocalTimeRollo ver=False; LogExtFileFlags=2199503; LogFormat=2; P eriod=1; TruncateSize=20971520} Name : Default Web Site ServerAutoStart : True TraceFailedRequestsLogging : @{Directory=%SystemDrive%\inetpub...
使用Remove-PSDrive来删除你创建的驱动器。如果该驱动器正在使用则不能删除。注意在使用New-PSDrive和Remove-PSDrive创建或删除驱动器时,指定的字母不能包含冒号,但是在使用驱动器工作时必须指定冒号。 Remove-PSDrive desktop 1. 读取文本文件的内容 使用Get-Content可以获取文本文件的内容: PS C:\PowerShell> Get-...
New-PSDrive Creates a Windows PowerShell drive in the current session. New-PSSession Creates a persistent connection to a local or remote computer. New-PSSessionOption Creates an object that contains advanced options for a PSSession. New-Service Creates a new Windows service. New-TimeSpan Creates ...
check-file-system.ps1 Checks the file system of a drive (needs admin rights). More » check-health.ps1 Checks the system health. More » check-ping.ps1 Checks the ping latency to the internet. More » check-swap-space.ps1 Checks the swap space for free space left. More » check...
Be sure to allow sufficient disk space on the drive on which logs are stored. Type:String Position:Named Default value:None Required:False Accept pipeline input:False Accept wildcard characters:False -LogRetentionInDays Specifies the number of days that log entries are stored. Log entries older ...
$disk = Get-WmiObject -class Win32_LogicalDisk -filter "DeviceID='C:'" Write-Host "Free space on drive C: at $($disk.freespace / $disk.size * 100) percent" 我更喜歡第一種形式,主要是因為我傾向于大多是使用 Windows PowerShell 初學者。 第一種形式是有點易於閱讀。 每個步驟的腳本,使邏輯...