[char]$_}$count=0$labels="data1","data2"foreach($diskin$disks) {$driveLetter=$letters[$count].ToString()$disk|Initialize-Disk-PartitionStyleMBR-PassThru|New-Partition-UseMaximumSize-DriveLetter$driveLetter|Format-Volume-FileSystemNTFS-NewFileSystemLabel$labels[$count]-Confirm:$false-Force$...
Name Used (GB) Free (GB) Provider Root --- --- --- --- --- A FileSystem A:\ Alias Alias C 14.41 112.10 FileSystem C:\ Cert Certificate \ D FileSystem D:\ Env Environment Function Function HKCU Registry HKEY_CURRENT_USER HKLM Registry HKEY_LOCAL_MACHINE Variable Variable WS...
... LogFilePath : %SystemRoot%\System32\Winevt\Logs\Setup.evtx MaximumSizeInBytes :1052672LogMode : Circular OwningProviderName :Microsoft-Windows-Eventlog ProviderNames : {Microsoft-Windows-WUSA,Microsoft-Windows-ActionQueue... ProviderLevel : ProviderKeywords : ProviderBufferSize :64ProviderMinimumNumb...
# 设置 CSV 文件路径$csvFilePath="C:\PerformanceLog.csv"# 添加标题(如果文件不存在)if(-not(Test-Path$csvFilePath)) {"Timestamp,CPU Usage,Memory Usage,Drive,Used Space,Free Space"|Out-File-FilePath$csvFilePath}# 记录数据到 CSVforeach($diskInfoin$diskUsage) {$csvEntry="$timestamp,$($c...
($i in $logicaldisk) { $DeviceID = ($i.DeviceID).ToString(); if($DeviceID -ne $null){ $disk_info[$DeviceID] = @{} if(($i.Size -ne 0) -and ($i.Size -ne $null)){ $disk_info[$DeviceID]['Total'] = ($i.Size/1073741824).ToString().Substring(0,5)+"Gb"; $disk_info...
False IncludePortInSPN : False OutputBufferingMode : None MaxConnectionRetryCount :0Culture : UICulture : MaximumReceivedDataSizePerCommand : MaximumReceivedObjectSize : ApplicationArguments : OpenTimeout :00:03:00CancelTimeout :00:01:00IdleTimeout :-00:00:00.0010000PS C:\WINDOWS\system32>Enter-PS...
# 选择一个磁盘(这里选择第一个磁盘,可以根据实际情况调整)$disk=Get-Disk-Number1# 创建一个新分区,大小为 10 GBNew-Partition-DiskNumber$disk.Number-UseMaximumSize|Format-Volume-FileSystemNTFS-NewFileSystemLabel"Data"-Confirm:$false 示例3: 删除分区 ...
clear $credential = Get-Credential foreach ( $args in get-Content c:\server.txt ) { get-WmiObject win 32 _logicaldisk -Credential $credential -ComputerName $args -Filter "Drivetype=3" | ft SystemName,DeviceID,VolumeName,@{Label= "Total SIze" ;Expression={$_.Size / 1...
-CacheSizeInGB Specifies the maximum size of the global disk cache in gigabytes. The type must be an integer value in the range of 0 to any positive integer. The default size is 15 GB. Type:Int32 Position:Named Default value:None ...
New-VM-ComputerNameServer1-NameVM1-MemoryStartupBytes4GB-BootDeviceVHD-NewVHDPath.\VMs\Win10.vhdx-Path.\VMData-NewVHDSizeBytes20GB-Generation2-SwitchNameExternalSwitch To create a virtual machine with a new virtual disk that boots to an operating system image, see the PowerShell example inCreate...