please can someone look over this and tell me what I am doing wrong? I am trying to modifiy the Custom Error message property's in an IIS website using powershell and wmi... This is what I have come up with.
$Server = "localhost"
$Wmi = Get-WmiObject -Class IIsWebServerSetting -Namespace "root\microsoftiisv2" -ComputerName $server -filter "ServerComment = 'SharePoint - SP80'" -Authentication 6
$CustomHttpError = $wmi | Foreach-Object { $_.HttpErrors | ? {$_.HttpErrorCode -contains "400"} | Select HttpErrorCode, HttpErrorSubcode, HandlerType,HandlerLocation;}
$CustomHttpError.HandlerLocation('C:\WINDOWS\help\iisHelp\common\Custom.htm')
I get the Error message "Method invocation failed because [Selected.System.Management.ManagementBaseObject] doesn't contain a method named 'HandlerLocation' "
When I use Get-Member to inspect $CustomHttpError I get the following.
TypeName: Selected.System.Management.ManagementBaseObject
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
HandlerLocation NoteProperty System.String HandlerLocation=C:\WINDOWS\help\iisHelp\common\400.htm
HandlerType NoteProperty System.String HandlerType=FILE
HttpErrorCode NoteProperty System.String HttpErrorCode=400
HttpErrorSubcode NoteProperty System.String HttpErrorSubcode=*
How do I modify the HandlerLocation Property if it is not a method I can invoke?