I wanted to list the set of resource measures on the SharePoint environment that I am working on. To get the list of resource measures we can use powershell, using the command
[Microsoft.SharePoint.Administration.SPUserCodeService]::Local.ResourceMeasures
I encountered the following error in the console.
Unable to find type [Microsoft.SharePoint.Administration.SPUserCodeService]: make sure that the assembly containing this type is loaded.
At line:1 char:56
+ [Microsoft.SharePoint.Administration.SPUserCodeService] <<<< ::Local.ResourceMeasures
+ CategoryInfo : InvalidOperation: (Microsoft.Share...UserCodeService:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Solved:
The problem was because SharePoint powershell snap in was not loaded.
The command to load the SharePoint powershell snap in is as follows. We need to just run this command in the powershell command prompt.
Add-PSSnapin Microsoft.SharePoint.Powershell