Not sure what the eff' is wrong! I am using Powershell 2.0 on Windows 7. Had this same script working on Windows XP , am i just missing something?
$server = "server1-vm1.prod.ds.russell.com"
$name = "Superduper_Reports"
$iis = [ADSI]"IIS://$server/W3SVC/AppPools/$name"
$iis.psbase.invoke("recycle")
Error (that invoke looks okay to me?):
Exception calling "Invoke" with "2" argument(s): "Unknown error (0x80005000)" At line:3 char:19 + $iis.psbase.invoke <<<< ("recycle") + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
When just running "$iis" variable i get this error:
The following exception occurred while retrieving member "PSComputerName": "Unknown error (0x80005000)" + CategoryInfo : NotSpecified: (:) [format-default], ExtendedTypeSystemException + FullyQualifiedErrorId : CatchFromBaseGetMember,Microsoft.PowerShell.Commands.FormatDefaultCommand
Roooarr! I'd rather use ADSI over WMI! Any help? :)