Open v2kiran opened 5 years ago
The animated GIF makes it kinda hard to troubleshoot.
From what I can see: C:\temp\PSAlphaPS
is a folder for which you are trying to get a FileInfo
?
With $PSVersion: 5.1.17134.228 on Windows 10, I get a populated EntryInfo using:
([Alphaleonis.Win32.Filesystem.FileInfo]::new("$env:windir\system32\notepad.exe")).EntryInfo
and
$file = ([Alphaleonis.Win32.Filesystem.FileInfo]::new("$env:windir\system32\notepad.exe"))
Both give the same output:
Directory : C:\WINDOWS\system32
DirectoryName : C:\WINDOWS\system32
Exists : True
IsReadOnly : False
Length : 245760
Name : notepad.exe
Attributes : Archive
CreationTime : 8/18/2018 11:44:24 AM
CreationTimeUtc : 8/18/2018 9:44:24 AM
Extension : .exe
FullName : C:\WINDOWS\system32\notepad.exe
LastAccessTime : 8/18/2018 11:44:24 AM
LastAccessTimeUtc : 8/18/2018 9:44:24 AM
LastWriteTime : 8/18/2018 11:44:24 AM
LastWriteTimeUtc : 8/18/2018 9:44:24 AM
EntryInfo : C:\WINDOWS\system32\notepad.exe
ah yeah should have known not to use a gif :).
Here is the the explanation in code.
I run 4 lines of code with 2 versions of Alphafs:
with version 2.1.2 . the output of line 4 lists a Alphaleonis.Win32.Filesystem.FileSystemEntryInfo
object as expected.
version 2.1.2
#Version 2.1.2
$Alphafs = "C:\temp\nuget\AlphaFS.2.1.2\lib\net45\AlphaFS.dll"
$pathstr = "C:\temp\PSAlphaFS"
Add-Type -Path $Alphafs
[alphaleonis.win32.filesystem.fileinfo]::new($pathstr).EntryInfo
# OUTPUT with 2.1.2
PS C:\>
AlternateFileName :
Attributes : Directory
CreationTime : 10/22/2018 9:25:03 PM
CreationTimeUtc : 10/22/2018 7:25:03 PM
FileName : PSAlphaFS
FileSize : 0
FullPath : C:\temp\PSAlphaFS
IsCompressed : False
IsHidden : False
IsDirectory : True
IsEncrypted : False
IsMountPoint : False
IsOffline : False
IsReadOnly : False
IsReparsePoint : False
IsSymbolicLink : False
LastAccessTime : 10/22/2018 9:25:06 PM
LastAccessTimeUtc : 10/22/2018 7:25:06 PM
LastWriteTime : 10/22/2018 9:25:06 PM
LastWriteTimeUtc : 10/22/2018 7:25:06 PM
LongFullPath : \\?\C:\temp\PSAlphaFS
ReparsePointTag : None
PS C:\>
I then run the same 4 lines of code with the latest version 2.2.6
version 2.2.6
#Version 2.2.6
$Alphafs = "C:\temp\nuget\AlphaFS.2.1.2\lib\net45\AlphaFS.dll"
$pathstr = "C:\temp\PSAlphaFS"
Add-Type -Path $Alphafs
[alphaleonis.win32.filesystem.fileinfo]::new($pathstr).EntryInfo
# OUTPUT with 2.2.6
PS C:\> $Alphafs = "C:\temp\nuget\AlphaFS.2.2.6\lib\net45\AlphaFS.dll"
$pathstr = "C:\temp\PSAlphaFS"
Add-Type -Path $Alphafs
[alphaleonis.win32.filesystem.fileinfo]::new($pathstr).EntryInfo
PS C:\>
as can be seen from the output we dont get any output for line 4 .
but if you assign the expression to a variable and then use the dot notation on the property we see the object:
$a = [alphaleonis.win32.filesystem.fileinfo]::new($pathstr)
$a.EntryInfo
PS C:\> $a = [alphaleonis.win32.filesystem.fileinfo]::new($pathstr)
$a.EntryInfo
AlternateFileName :
Attributes : Directory
CreationTime : 10/22/2018 9:25:03 PM
CreationTimeUtc : 10/22/2018 7:25:03 PM
FileName : PSAlphaFS
FileSize : 0
FullPath : C:\temp\PSAlphaFS
IsCompressed : False
IsHidden : False
IsDirectory : True
IsEncrypted : False
IsMountPoint : False
IsOffline : False
IsReadOnly : False
IsReparsePoint : False
IsSymbolicLink : False
LastAccessTime : 10/22/2018 9:25:06 PM
LastAccessTimeUtc : 10/22/2018 7:25:06 PM
LastWriteTime : 10/22/2018 9:25:06 PM
LastWriteTimeUtc : 10/22/2018 7:25:06 PM
LongFullPath : \\?\C:\temp\PSAlphaFS
ReparsePointTag : None
This should work without having to assign the expression to a variable.
Powershell Version:
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Tested on Windows PowerShell v5.1
Alphafs v2.1.2
Alphafs v2.2.6