Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - RPC server unavailable

Reply
 
Old 12-10-2008   #1 (permalink)
Jacob Sampson


 
 

RPC server unavailable

Below is the error I am getting. I am getting the name of installed apps on
remote machines. It works if I query my local machine. I have never needed
to provide authentication for accessing WMI objects but do i need it for this
particualr object? The variable $computername does hold an available
computername I have already tested that.

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
0x80070
6BA)
At C:\getcomputerlist.ps1:8 char:22
+ $applications = gwmi <<<< Win32_product -computername '$computername'

My System SpecsSystem Spec
Old 12-10-2008   #2 (permalink)
Vadims Podans


 
 

Re: RPC server unavailable

put $computername variable in double quotes, not in single. If you set
variable in single quotes PowerShell wil not expand variable. See examples:

[vPodans] $computername = "computer"
[vPodans] '$computername'
$computername
[vPodans] "$computername"
computer

you see, that variable is expanded only in double quotes.

Enjoy!
--
WBR, Vadims Podans
PowerShell blog - www.sysadmins.lv

"Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā
"news:BFEC265D-4940-480A-A3A4-D7AE1AA3B42A@xxxxxx"...
Quote:

> Below is the error I am getting. I am getting the name of installed apps
> on
> remote machines. It works if I query my local machine. I have never
> needed
> to provide authentication for accessing WMI objects but do i need it for
> this
> particualr object? The variable $computername does hold an available
> computername I have already tested that.
>
> Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
> 0x80070
> 6BA)
> At C:\getcomputerlist.ps1:8 char:22
> + $applications = gwmi <<<< Win32_product -computername
> '$computername'
My System SpecsSystem Spec
Old 12-10-2008   #3 (permalink)
Jacob Sampson


 
 

Re: RPC server unavailable

Great that fixed it. It seems that there are instances where sometimes I
have had to use single quote and sometimes double quotes to expand my
variable am i not remembering correctly?

Thanks for your help.

"Vadims Podans" wrote:
Quote:

> put $computername variable in double quotes, not in single. If you set
> variable in single quotes PowerShell wil not expand variable. See examples:
>
> [vPodans] $computername = "computer"
> [vPodans] '$computername'
> $computername
> [vPodans] "$computername"
> computer
>
> you see, that variable is expanded only in double quotes.
>
> Enjoy!
> --
> WBR, Vadims Podans
> PowerShell blog - www.sysadmins.lv
>
> "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā
> "news:BFEC265D-4940-480A-A3A4-D7AE1AA3B42A@xxxxxx"...
Quote:

> > Below is the error I am getting. I am getting the name of installed apps
> > on
> > remote machines. It works if I query my local machine. I have never
> > needed
> > to provide authentication for accessing WMI objects but do i need it for
> > this
> > particualr object? The variable $computername does hold an available
> > computername I have already tested that.
> >
> > Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
> > 0x80070
> > 6BA)
> > At C:\getcomputerlist.ps1:8 char:22
> > + $applications = gwmi <<<< Win32_product -computername
> > '$computername'
>
>
My System SpecsSystem Spec
Old 12-10-2008   #4 (permalink)
Vadims Podans


 
 

Re: RPC server unavailable

You're right. In WMI queries you will frequently use double and single
quotes compination. For example:

gwmi win32_share -filter "name = '$name' "

here variable is in single quotes. But here also are outer double quotes.
Outer quotes determine will be expanded inner variables or not. See these
examples:
[vPodans] $computer = "variable"
[vPodans] " '$computer' "
'variable'
[vPodans] ' "$computer" '
"$computer"

There is only one reason, why we should use single quotes inside double
quotes - parameter value may contain spaces. Therefore we should put value
into quotes to represent value with spaces as whole string. If you put value
in double quotes (when you already have outer double quotes) you'll get
quotes violation.
Enjoy!

--
WBR, Vadims Podans
PowerShell blog - www.sysadmins.lv

"Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā
"news:13860132-4470-454F-9F32-93F4B5DEA4EC@xxxxxx"...
Quote:

> Great that fixed it. It seems that there are instances where sometimes I
> have had to use single quote and sometimes double quotes to expand my
> variable am i not remembering correctly?
>
> Thanks for your help.
>
> "Vadims Podans" wrote:
>
Quote:

>> put $computername variable in double quotes, not in single. If you set
>> variable in single quotes PowerShell wil not expand variable. See
>> examples:
>>
>> [vPodans] $computername = "computer"
>> [vPodans] '$computername'
>> $computername
>> [vPodans] "$computername"
>> computer
>>
>> you see, that variable is expanded only in double quotes.
>>
>> Enjoy!
>> --
>> WBR, Vadims Podans
>> PowerShell blog - www.sysadmins.lv
>>
>> "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja
>> ziņojumā
>> "news:BFEC265D-4940-480A-A3A4-D7AE1AA3B42A@xxxxxx"...
Quote:

>> > Below is the error I am getting. I am getting the name of installed
>> > apps
>> > on
>> > remote machines. It works if I query my local machine. I have never
>> > needed
>> > to provide authentication for accessing WMI objects but do i need it
>> > for
>> > this
>> > particualr object? The variable $computername does hold an available
>> > computername I have already tested that.
>> >
>> > Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT:
>> > 0x80070
>> > 6BA)
>> > At C:\getcomputerlist.ps1:8 char:22
>> > + $applications = gwmi <<<< Win32_product -computername
>> > '$computername'
>>
>>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
RPC server unavailable Vista General
The RPC server is unavailable PowerShell
RPC Server is unavailable Vista networking & sharing
RPC Server is unavailable Vista General
The RPC server is unavailable. Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46