A custom solution was installed at one point, and was removed do to it not functioning as expected. after the solution was removed several fields remained, and I'm trying to remove them with the script below.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
$w = Get-SPWeb http://spdev1
$f = $w.Fields

When running the script, i'm getting the following error:

PS C:\Users\user\Desktop> $f.Delete("slamidnumber")
Exception calling "Delete" with "1" argument(s): "Value does not fall within
the expected range."
At line:1 char:1
+ $f.Delete("slamidnumber")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException

I have also tried the following with similar results:

PS C:\Users\jwhite\Desktop> $f.Fields("slamidnumber").Delete()
Method invocation failed because [Microsoft.SharePoint.SPFieldBoolean] doesn't
contain a method named 'Fields'.
At line:1 char:1
+ $f.Fields("slamidnumber").Delete()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

after running the recommended changes, I'm getting the following error:

PS C:\Users\user\Desktop> $f.Fields["slamidnumber"].Delete()
An error occurred while enumerating through a collection: Field type
SlamIdField is not installed properly. Go to the list settings page to delete
this field. .
At line:1 char:1
+ $f.Fields["slamidnumber"].Delete()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.Share...on+SPEnumer
ator:SPEnumerator) [], RuntimeException
+ FullyQualifiedErrorId : BadEnumeration

Try this one...

$w = Get-SPWeb http://spdev1
$f = $w.Fields["slamidnumber"]
$f.Sealed = $false
  • unfortunately the sealed property is not available for object
    – Jason
    Sep 3 '13 at 14:21

Use square brackets on the `Fields' property, which hangs off the web variable.


  • you suggestion did resolve my initial error, now i'm running into a new issue (added to my initial post)
    – Jason
    Sep 2 '13 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.