Managing permissions with PowerShell is only a bit easier than in VBS or the command line as there are no cmdlets for most day-to-day tasks like getting a permission report or adding permission to an item. PowerShell only offers Get-Acl and Set-Acl but everything in between getting and setting the ACL is missing. This module closes the gap.
MIT License
431
stars
61
forks
source link
Object reference not set to an instance of an object #86
VERBOSE: EnablePrivileges enabled in PrivateDate
Get-NTFSAccess : Object reference not set to an instance of an object.
At C:\Users\\CAD_Folder_Creation.ps1:63 char:1
writeErrorStream : True
Exception : System.NullReferenceException: Object reference not set to an instance of an object.
at NTFSSecurity.BaseCmdlet.GetRelativePath(String path) in C:\Git\NTFSSecurity\NTFSSecurity\BaseCmdlets.cs:line 117
at NTFSSecurity.BaseCmdlet.GetFileSystemInfo2(String path) in C:\Git\NTFSSecurity\NTFSSecurity\BaseCmdlets.cs:line 74
at NTFSSecurity.GetAccess.ProcessRecord() in C:\Git\NTFSSecurity\NTFSSecurity\AccessCmdlets\GetAccess.cs:line 91
TargetObject : \\01-MOD
CategoryInfo : OpenError: (\\01-MOD:String) [Get-NTFSAccess], NullReferenceException
FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Set-FolderPermissions, C:\Users\\CAD_Folder_Creation.ps1: line 63
at , C:\Users\\CAD_Folder_Creation.ps1: line 650
PipelineIterationInfo : {0, 1}
PSMessageDetails :
If I use "Get-NTFSAccess \\01-MOD" in a clean powershell session the command returns correctly. If I try after this error comes up, I get the same error. What is the NullReference?
Using a call of:
Get-NTFSAccess -Path $mypath -Verbose $ERROR[0] | fl -force
VERBOSE: EnablePrivileges enabled in PrivateDate Get-NTFSAccess : Object reference not set to an instance of an object. At C:\Users\\CAD_Folder_Creation.ps1:63 char:1
VERBOSE: EnablePrivileges enabled in PrivateDate VERBOSE: Disabeling all 4 enabled privileges... VERBOSE: TakeOwnership disabled VERBOSE: Restore disabled VERBOSE: Backup disabled VERBOSE: Security disabled VERBOSE: ...finished
writeErrorStream : True Exception : System.NullReferenceException: Object reference not set to an instance of an object. at NTFSSecurity.BaseCmdlet.GetRelativePath(String path) in C:\Git\NTFSSecurity\NTFSSecurity\BaseCmdlets.cs:line 117 at NTFSSecurity.BaseCmdlet.GetFileSystemInfo2(String path) in C:\Git\NTFSSecurity\NTFSSecurity\BaseCmdlets.cs:line 74 at NTFSSecurity.GetAccess.ProcessRecord() in C:\Git\NTFSSecurity\NTFSSecurity\AccessCmdlets\GetAccess.cs:line 91 TargetObject : \\01-MOD
CategoryInfo : OpenError: (\\01-MOD:String) [Get-NTFSAccess], NullReferenceException
FullyQualifiedErrorId : ReadFileError,NTFSSecurity.GetAccess
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Set-FolderPermissions, C:\Users\\CAD_Folder_Creation.ps1: line 63
at , C:\Users\\CAD_Folder_Creation.ps1: line 650
PipelineIterationInfo : {0, 1}
PSMessageDetails :
If I use "Get-NTFSAccess \\01-MOD" in a clean powershell session the command returns correctly. If I try after this error comes up, I get the same error. What is the NullReference?