The Repair-Volume cmdlet adds explicit CR+LF at the end of each of every message in the Verbose stream. As a result, the verbose report is very difficult to read.
This issue is a regression from PowerShell 5.1.
Repair-Volume -DriveLetter D -Scan -Verbose
VERBOSE: Volume label is "Cayotte's plans to catch the roadrunner".
VERBOSE: Stage 1: Examining basic file system structure ...
VERBOSE:
VERBOSE: ##### file records processed.
VERBOSE: File verification completed.
VERBOSE:
VERBOSE: # large file records processed.
VERBOSE:
VERBOSE: # bad file records processed.
VERBOSE: Stage 2: Examining file name linkage ...
VERBOSE:
VERBOSE: #### reparse records processed.
VERBOSE:
VERBOSE: ##### index entries processed.
VERBOSE:
VERBOSE: Index verification completed.
VERBOSE:
VERBOSE: #### reparse records processed.
VERBOSE: Stage 3: Examining security descriptors ...
VERBOSE: Security descriptor verification completed.
VERBOSE:
VERBOSE: ### data files processed.
VERBOSE: CHKDSK is verifying Usn Journal...
VERBOSE:
VERBOSE: ######## USN bytes processed.
VERBOSE: Usn Journal verification completed.
VERBOSE: Windows has scanned the file system and found no problems.
VERBOSE: No further action is required.
VERBOSE: ######## KB total disk space.
VERBOSE: ######## KB in 5308 files.
VERBOSE: ######## KB in 724 indexes.
VERBOSE: ######## KB in use by the system.
VERBOSE: ######## KB occupied by the log file.
VERBOSE: ######## KB available on disk.
VERBOSE: ######## bytes in each allocation unit.
VERBOSE: ######## total allocation units on disk.
VERBOSE: ######## allocation units available on disk.
NoErrorsFound
VERBOSE: Volume label is "Cayotte's plans to catch the roadrunner".
VERBOSE:
VERBOSE: Stage 1: Examining basic file system structure ...
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: ##### file records processed.
VERBOSE:
VERBOSE: File verification completed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: # large file records processed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: # bad file records processed.
VERBOSE:
VERBOSE: Stage 2: Examining file name linkage ...
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: #### reparse records processed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: ##### index entries processed.
VERBOSE:
VERBOSE: Index verification completed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: #### reparse records processed.
VERBOSE:
VERBOSE: Stage 3: Examining security descriptors ...
VERBOSE:
VERBOSE: Security descriptor verification completed.
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: ### data files processed.
VERBOSE:
VERBOSE: CHKDSK is verifying Usn Journal...
VERBOSE:
VERBOSE:
VERBOSE:
VERBOSE: ######## USN bytes processed.
VERBOSE:
VERBOSE: Usn Journal verification completed.
VERBOSE:
VERBOSE: Windows has scanned the file system and found no problems.
VERBOSE:
VERBOSE: No further action is required.
VERBOSE:
VERBOSE: ######## KB total disk space.
VERBOSE:
VERBOSE: ######## KB in 5308 files.
VERBOSE:
VERBOSE: ######## KB in 724 indexes.
VERBOSE:
VERBOSE: ######## KB in use by the system.
VERBOSE:
VERBOSE: ######## KB occupied by the log file.
VERBOSE:
VERBOSE: ######## KB available on disk.
VERBOSE:
VERBOSE: ######## bytes in each allocation unit.
VERBOSE:
VERBOSE: ######## total allocation units on disk.
VERBOSE:
VERBOSE: ######## allocation units available on disk.
VERBOSE:
NoErrorsFound
Name Value
---- -----
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
/cc @anmenaga I guess it comes from WinCompat feature.
not related to WinCompat; at least v2 of the Storage module declares compatibility with PS Core CompatiblePSEditions = @('Desktop', 'Core') and is loaded directly into PS Core with repro:
...
VERBOSE: 4096 bytes in each allocation unit.
VERBOSE: 58170335 total allocation units on disk.
VERBOSE: 43118095 allocation units available on disk.
NoErrorsFound
PS C:\> Get-Module -Name Storage
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Manifest 2.0.0.0 Storage {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDomain鈥
PS C:\> (Get-Module -Name Storage).Path
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Storage\Storage.psd1
Looks like CIM object is calling some native app and transimts its output as Verbose message. Here is a repro using CIM cmdlets:
$VerbosePreference = 'Continue';
$Volume = Get-CimInstance -Namespace "root\Microsoft\Windows\Storage" -ClassName "MSFT_Volume" | Select-Object -First 1
Invoke-CimMethod -InputObject $Volume -Arguments @{Scan=$True} -MethodName "Repair"
Should we fix this in Engine? Escape '\n' in verbose out?
@anmenaga Hello. 馃槉 And thanks for your input. However, I went ahead and run the sample script that you devised. Here is the output:
$VerbosePreference = 'Continue';
$Volume = Get-CimInstance -Namespace "root\Microsoft\Windows\Storage" -ClassName "MSFT_Volume" | Select-Object -First 1
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\Microsoft\Windows\Storage,'className' = MSFT_Volume'.
md5-a3a1581c1c55a304e57c951e34aa831a
```None
DriveLetter : Z
DriveType : 3
FileSystem : NTFS
FileSystemLabel : Contoso's top-secret volume
HealthStatus : 0
md5-c358adf883ef838aeb19aca104bad1da
```None
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''instance' = MSFT_Volume (ObjectId = "{1}\\CONTOSO1\root/Microsoft/Windows/St...),'namespaceName' = root/Microsoft/Windows/Storage,'methodName' = Repair'.
CreatedStorageJob :
ExtendedStatus :
Output : 0
ReturnValue : 0
PSComputerName :
VERBOSE: Operation 'Invoke CimMethod' complete.
Okay... That's not the output I expected...
Most helpful comment
not related to WinCompat; at least
v2of theStoragemodule declares compatibility with PS CoreCompatiblePSEditions = @('Desktop', 'Core')and is loaded directly into PS Core with repro:Looks like CIM object is calling some native app and transimts its output as Verbose message. Here is a repro using CIM cmdlets: