|
@@ -3,6 +3,7 @@ using System; |
|
|
using System.Collections; |
|
|
using System.Collections; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Management.Automation; |
|
|
using System.Management.Automation; |
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
|
namespace NTFSSecurity |
|
|
namespace NTFSSecurity |
|
|
{ |
|
|
{ |
|
@@ -22,6 +23,7 @@ namespace NTFSSecurity |
|
|
private SwitchParameter skipMountPoints; |
|
|
private SwitchParameter skipMountPoints; |
|
|
private SwitchParameter skipSymbolicLinks; |
|
|
private SwitchParameter skipSymbolicLinks; |
|
|
private bool getFileSystemModeProperty = false; |
|
|
private bool getFileSystemModeProperty = false; |
|
|
|
|
|
private bool identifyHardLinks = false; |
|
|
private int? depth; |
|
|
private int? depth; |
|
|
|
|
|
|
|
|
WildcardPattern wildcard = null; |
|
|
WildcardPattern wildcard = null; |
|
@@ -139,6 +141,7 @@ namespace NTFSSecurity |
|
|
modeMethodInfo = typeof(FileSystemCodeMembers).GetMethod("Mode"); |
|
|
modeMethodInfo = typeof(FileSystemCodeMembers).GetMethod("Mode"); |
|
|
|
|
|
|
|
|
getFileSystemModeProperty = (bool)((Hashtable)MyInvocation.MyCommand.Module.PrivateData)["GetFileSystemModeProperty"]; |
|
|
getFileSystemModeProperty = (bool)((Hashtable)MyInvocation.MyCommand.Module.PrivateData)["GetFileSystemModeProperty"]; |
|
|
|
|
|
identifyHardLinks = (bool)((Hashtable)MyInvocation.MyCommand.Module.PrivateData)["IdentifyHardLinks"]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override void ProcessRecord() |
|
|
protected override void ProcessRecord() |
|
@@ -303,6 +306,18 @@ namespace NTFSSecurity |
|
|
if (getFileSystemModeProperty) |
|
|
if (getFileSystemModeProperty) |
|
|
item.Properties.Add(new PSCodeProperty("Mode", modeMethodInfo)); |
|
|
item.Properties.Add(new PSCodeProperty("Mode", modeMethodInfo)); |
|
|
|
|
|
|
|
|
|
|
|
if (identifyHardLinks == true && current is FileInfo) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
item.Properties.Add(new PSNoteProperty("HardLinkCount", Alphaleonis.Win32.Filesystem.File.EnumerateHardlinks(current.FullName).Count())); |
|
|
|
|
|
} |
|
|
|
|
|
catch |
|
|
|
|
|
{ |
|
|
|
|
|
WriteDebug(string.Format("Could not read hard links for '{0}'", current.FullName)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WriteObject(item); |
|
|
WriteObject(item); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|