I recently installed the posh4appv snapin to my AppV 4.6 Management server to script package installation and manipulation because we are going to be moving to a phase where we need less manual management of the console.
While installing it I ran across an error whenever I tried to run it:
PS C:\Users\svc_test> Get-AppVAdministrators
Get-AppVAdministrators : Object reference not set to an instance of an object.
At line:1 char:23
+ Get-AppVAdministrators <<<<
+ CategoryInfo : NotSpecified: (:) [Get-AppVAdministrators], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,AppVSnapIn.GetAdministrators
I ran a procmon on this and traced on PowerShell.exe and it told me I was missing the "HKLM\SOFTWARE\Wow6432Node\Microsoft\SoftGrid\4.5\Server\SQLServerName" registry key. I added that key as a REG_SZ and the value being our SQL server name. I then tried to run the command about again and it failed again, but this time it reported the SQLDatabaseName registry key was missing. I added that to the registry and then tried again. It gave me one last fail.
This time on SOFTGRID_CONTENT_DIR. I added that key as a REG_SZ with the appropriate value and then I tried to run my command again. Low and behold it now works!