Discussion:
PS Bug RPC Server / WMI
(too old to reply)
Tobias Weltner
2008-06-14 06:48:38 UTC
Permalink
When I do this, I get a strange "RPC Server not available" error message:

$klasse = 'Win32_Service'
$methode = 'StopService'
$class = [wmiclass]$klasse
$class.psbase.methods[$methode].OutParameters

When done from within VB.NET, all is good:

Dim methode = "StopService"
Dim c As New System.Management.ManagementClass(klasse)
Dim o As Object = c.Methods(methode).OutParameters
MsgBox(o.GetType.Name)

This seems to be a bug in PowerShell. Can anyone explain/provide a
workaround?
Thx
Tobias
www.powershell.com
alexandair
2008-06-15 14:27:05 UTC
Permalink
Post by Tobias Weltner
$klasse = 'Win32_Service'
$methode = 'StopService'
$class = [wmiclass]$klasse
$class.psbase.methods[$methode].OutParameters
Dim methode = "StopService"
Dim c As New System.Management.ManagementClass(klasse)
Dim o As Object = c.Methods(methode).OutParameters
MsgBox(o.GetType.Name)
This seems to be a bug in PowerShell. Can anyone explain/provide a
workaround?
Thx
Tobiaswww.powershell.com
It looks like the bug is present in v2 CTP2 (error message: format-
default : Exception retrieving members: "The RPC server is
unavailable. (Exception from HRESULT: 0x800706BA)").
I don't get any errors in v1.

-aleksandar
http://powershellers.blogspot.com
Karl Prosser[MVP]
2008-06-15 18:36:18 UTC
Permalink
i get this error in V1
alexandair
2008-06-15 21:05:05 UTC
Permalink
Post by Karl Prosser[MVP]
i get this error in V1
strange. it looks like it works only for me. :-)

PS> $klasse = 'Win32_Service'
PS> $methode = 'StopService'
PS> $class = [wmiclass]$klasse
PS> $class.psbase.methods[$methode].OutParameters

__GENUS : 1
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH : __PARAMETERS
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER : WINXPSP2TEST
__NAMESPACE : ROOT\CIMV2
__PATH : \\WINXPSP2TEST\ROOT\CIMV2:__PARAMETERS
ReturnValue :

-aleksandar
http://powershellers.blogspot.com
Jon
2008-06-16 10:47:09 UTC
Permalink
To confuse matters further I get a similar output to you on an XP SP2
machine, which has Powershell v2 CTP 2 installed, so there must be some
other criteria at work
--
Jon
Post by Karl Prosser[MVP]
i get this error in V1
strange. it looks like it works only for me. :-)

PS> $klasse = 'Win32_Service'
PS> $methode = 'StopService'
PS> $class = [wmiclass]$klasse
PS> $class.psbase.methods[$methode].OutParameters

__GENUS : 1
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH : __PARAMETERS
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER : WINXPSP2TEST
__NAMESPACE : ROOT\CIMV2
__PATH : \\WINXPSP2TEST\ROOT\CIMV2:__PARAMETERS
ReturnValue :

-aleksandar
http://powershellers.blogspot.com
alexandair
2008-06-15 14:48:05 UTC
Permalink
Post by Tobias Weltner
$klasse = 'Win32_Service'
$methode = 'StopService'
$class = [wmiclass]$klasse
$class.psbase.methods[$methode].OutParameters
Dim methode = "StopService"
Dim c As New System.Management.ManagementClass(klasse)
Dim o As Object = c.Methods(methode).OutParameters
MsgBox(o.GetType.Name)
This seems to be a bug in PowerShell. Can anyone explain/provide a
workaround?
Thx
Tobiaswww.powershell.com
In v2 CTP2 this command will give you an object pretty similar to
working one in v1:

$class.psbase.Methods[$methode].OutParameters.psbase | select -expand
systemproperties | select name,value

-aleksandar
http://powershellers.blogspot.com
/\\/\\o\\/\\/
2008-06-15 15:59:33 UTC
Permalink
Tobias,

I strugled with this also some times, but you can use the methods fine :

It's a problem related with this issue Management base objects , I bugged
this on connect
https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=288425&SiteID=99

I confirmed this int CTP2, it is still there :

PS C:\Windows\System32>
([wmiclass]'win32_service').psbase.methods['StopService'].OutParameters
format-default : Exception retrieving members: "The RPC server is
unavailable. (Exception from HRESULT: 0x800706BA)"

See that is is a ManagementbaseObject :
PS C:\Windows\System32>
([wmiclass]'win32_service').psbase.methods['StopService']


Name : StopService
InParameters :
OutParameters : System.Management.ManagementBaseObject
Origin : CIM_Service
Qualifiers : {MappingStrings, Override, ValueMap}

as the issue I bugged that is also still there in CTP2 :

PS C:\Windows\System32> $a |% {$_.psbase.Properties.Item('NdisCoLinkSpeed')}
|% {$_.value}
format-default : Exception retrieving members: "Not found "

Greetings /\/\o\/\/
Post by Tobias Weltner
$klasse = 'Win32_Service'
$methode = 'StopService'
$class = [wmiclass]$klasse
$class.psbase.methods[$methode].OutParameters
Dim methode = "StopService"
Dim c As New System.Management.ManagementClass(klasse)
Dim o As Object = c.Methods(methode).OutParameters
MsgBox(o.GetType.Name)
This seems to be a bug in PowerShell. Can anyone explain/provide a
workaround?
Thx
Tobias
www.powershell.com
Jon
2008-06-15 16:50:44 UTC
Permalink
Greetings

Certainly looks like a bug. For a workaround, this seems to work here.
Don't ask me why though ;-)

$methode = "StopService"
$klasse = "Win32_Service"
$c = New-Object System.Management.ManagementClass($klasse)
$op = $c.psbase.Methods[$methode].OutParameters
$o = ($op.psbase.properties)
$o = ($op.psbase.properties) #Twice required!?!
$o


$methode = "Create"
$klasse = "Win32_Process"
$c = New-Object System.Management.ManagementClass($klasse)
$op = $c.psbase.Methods[$methode].OutParameters
$o = ($op.psbase.properties)
$o = ($op.psbase.properties) #Twice required!?!
$o
--
Jon
Loading...