Get-FileSharePermission crashes when a share has NO permissions

Issue #188 resolved
Former user created an issue

Yep, don't know how we got into that state but we had a share with no ACEs, not even for Everyone. In that case the script crashes as follows:

Get-FileSharePermission : You cannot call a method on a null-valued expression.
At C:\ProdOps\Common\PowerShell\Carbon\Functions\Install-FileShare.ps1:212 char:27
+             $permission = Get-FileSharePermission -Name $Name -Identity $identit ...
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-FileSharePermission], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Get-FileSharePermission

Comments (5)

  1. Aaron Jensen repo owner

    I was never able to reproduce this issue, but I inspected the code for any place I wasn't checking for a null value and added additional checks. Hopefully this solves the problem. The fix will be part of Carbon 2.2.0.

  2. Log in to comment