I'm trying to multithread this
$var3 = Get-ItemPropertyValue $var2 -Name fullName,CreationTime,lastAccessTime,LastWriteTime,length;
by replacing it with:
$var3 = forEach($file in $var2) {
start-job -name "bla" -scriptblock {Get-ItemPropertyValue $file.FullName -Name fullName,LastWriteTime,CreationTime,lastAccessTime,length} | out-null
}
where $var2
holds a list of files retrieved via gci
.
This works for normal paths, but not for long UNC Paths prefixed by \\?\UNC\
.
The long path itself works fine with the get-itemPropertyValue '\\?\UNC\some long path in Webdav'
but doesn't as soon as I put it into the scriptBlock from start-job.
The errormessage says (in german):
"Das Argument für den Parameter "Path" kann nicht überprüft werden. Das Argument ist NULL oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus. + CategoryInfo : InvalidData: (:) [Get-ItemPropertyValue], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand + PSComputerName : localhost
When I try to bind it with get-itemPropertyValue -LocalPath '\\?\UNC\some long path in Webdav'
it also fails but with this Errormessage:
Das Argument kann nicht an den Parameter "LiteralPath" gebunden werden, da es NULL ist. + CategoryInfo : InvalidData: (:) [Get-ItemPropertyValue], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand + PSComputerName : localhost
Can anyone please check, if it is true, that this doesn't work, or show a running example otherwise? I'm running PS Version 5.1 and have to use this version.
Thanks in advance.