invoke-wmimethod -inputobject

  • $share = gwmi -class Win32_Share -computername 'fwcsqlbk01vp'

    $mask = invoke-wmimethod -inputobject $share -name getaccessmask

    when i run this script I get the following error .

    Invoke-WmiMethod : Cannot convert 'System.Object[]' to the type 'System.Management.ManagementObject' required by parameter 'InputObject'. Specified method is not supported

    .

    At H:\powershell\win32_share.ps1:7 char:30

    + invoke-wmimethod -inputobject <<<< $share -name getaccessmask

    + CategoryInfo : InvalidArgument: (:) [Invoke-WmiMethod], ParameterBindingException

    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.InvokeWmiMethod

  • I believe that your first problem is that $share is a collection. To resolve that try $share[0] either in place or by assigning to another variable. $share[0] is a ManagementObject but it then fails on the WMI invocation for some other reason.

    Hope this gets you a little farther.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply