I have a script which get file version, file type is .dll I had verified manually file version if it is available.
This is the script:
$version = ''
$file = Get-ChildItem $path
$version = $file.VersionInfo.FileVersion
Some times I get a output like this: 2023.3.0.8
and this is expected.
Some time I get below error:
Cannot convert value "2023.3.0.8" to type "System.Int32". Error:
"Input string was not in a correct format."
+ $version = $file.VersionInfo.FileVersion
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [],
ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RuntimeException